PHP Installation
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Installation

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old December 9th, 2004, 08:48 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
Help with PHP FORM - im a n00b.

Ok here's the deal i made a website for my brother. He owns his own nutritional supplements shop in our city. He decided to do like a catalog + web order to expand business. I made him a quick simple site to get started and decided to try something new.
I have NOT the slightest clue when it comes to PHP but wanted to use a FORM using PHP so i can send from web.

Here is the page: www.total-nutrition1.com/contact.php

If you look at that page i have set it up for the most part the way i want it... the way the forms are setup and the way it turns out when hitting send (new page opens saying Thank you...blah, blah blah...).

My problem im having is when users are typing in the form and hitting submit the only thing i am getting in the email is the Name field (not filled out) and which radio button they checked... nothing else... can someone please help me... and look at my code...

php Code:
Original - php Code
  1.  
  2. <?php
  3.    if ($_SERVER['REQUEST_METHOD'] != 'POST'){
  4.       $me = $_SERVER['PHP_SELF'];
  5. ?>
  6.    <form name="form1" method="post" action="<?php echo $me;?>">
  7.                                                                         <div align="center">
  8.                                                                             <br>
  9.                                                                            
  10.                                                                             To better assist you,<br>
  11.                                                                             please fill in the area(s) below:
  12.                                                                             <p>Name:<input type="text" name="Name" size="28"></p>
  13.                                                                             <p>Address:<input type="text" name="Address" size="26"></p>
  14.                                                                             <p>City:<input type="text" name="City" size="24"></p>
  15.                                                                             <p>State:<input type="text" name="State" size="5"> Zip:<input type="text" name="textfieldName" size="11"></p>
  16.                                                                             <p>E-Mail:<input type="text" name="E-mail Address" size="28"><br>
  17.                                                                                 <br>
  18.                                                                                 <b>Please select the best option<br>
  19.                                                                                      that you are inquiring about:</b></p>
  20.                                                                         </div>
  21.                                                                         <div align="left">
  22.                                                                             <p><input type="radio" name="radiobutton" value="ordering" checked>Ordering<br>
  23.                                                                                 <input type="radio" name="radiobutton" value="comments">Comment(s)<br>
  24.                                                                                 <input type="radio" name="radiobutton" value="shipping">Shipping<br>
  25.                                                                                 <input type="radio" name="radiobutton" value="general">General<br>
  26.                                                                                 <input type="radio" name="radiobutton" value="catalog">Catalog Request</p>
  27.                                                                         </div>
  28.                                                                         <div align="center">
  29.                                                                             <p>Comments:<br>
  30.                                                                                 <textarea name="Comments" rows="8" cols="38"></textarea></p>
  31.                                                                             <p><input type="submit" name="Submit" value="Submit"> <input type="reset" value="Clear Form" name="reset"></p>
  32.                                                                         </div>
  33.                                                                     </form>
  34.                                                                         <?php
  35.    } else {
  36.       error_reporting(0);
  37.       $recipient = 'jay-peezee@sbcglobal.net';
  38.       $msg ="Name: $fromnn".stripslashes($_POST['name']);
  39.       $msg.="nabout: ".$_POST['radiobutton'];
  40.       if (mail($recipient, $subject, $msg))
  41.          echo nl2br("<br><center><b>Your Inquiry has been received.<br>Thank You !</b></center>");
  42.       else
  43.          echo "Message failed to send";
  44. }
  45. ?>


Sorry if it's messy... Like i said above I KNOW NOTHING in PHP. This is what i've been able to do so far from just reading... and im stuck... please help me out.

Reply With Quote
  #2  
Old December 9th, 2004, 01:53 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
RE: Help with PHP FORM - im a n00b.

well from the look of your code, the only things you are including in the email are the name and radiobutton selection, and the reason the name is empty is because PHP is case sensitive and the form element name is "Name" and the post variable you are accessing is "name".(should be $_POST['Name']) If you want the rest of the information to appear, you need to add it to the $msg variable.

Reply With Quote
  #3  
Old December 9th, 2004, 04:53 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Help with PHP FORM - im a n00b.

Thank you for the input... changing the case sensitivity worked for the name field... now im trying to get the rest to output same with the textfield (comments) box.
Hmm... What kind of code/tag would i use for the rest... I tried copying the name code (like below) and changing the names but wouldnt show up once emailed.

I tried using this line for the other fields - and just changing names:
php Code:
Original - php Code
  1. $msg ="address: $fromnn".stripslashes($_POST['address']);


but for some reason it wont work...

Reply With Quote
  #4  
Old December 9th, 2004, 07:16 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
RE: Help with PHP FORM - im a n00b.

once again case sensetivity is the issue, the form field for address is named "Address", so the post variable must look like this

$_POST['Address']

Reply With Quote
  #5  
Old December 10th, 2004, 08:30 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 25
RE: Help with PHP FORM - im a n00b.

Here is the new code mixed with the HTML form... please let me know what im doing wrong... I am still having trouble... My first problem is when receiving the email it takes superrrrrrr long. (delayed about 3-4hrs.) second problem it still will not output the correct information in the email... still comes in blank. please help !!!

Here is the TEST page here: http://www.total-nutrition1.com/contact2.php

php Code:
Original - php Code
  1. <?php
  2.    if ($_SERVER['REQUEST_METHOD'] != 'POST'){
  3.       $me = $_SERVER['PHP_SELF'];
  4. ?>
  5.    <form name="form1" method="post" action="<?php echo $me;?>">
  6.                                                                         <div align="center">
  7.                                                                             <b> To better assist you,<br>
  8.                                                                                     please fill in the area(s) below:<br>
  9.                                                                             </b><br>
  10.                                                                             <table width="270" border="0" cellspacing="1" cellpadding="0">
  11.                                                                                 <tr>
  12.                                                                                     <td align="right">Name:</td>
  13.                                                                                     <td><input type="text" name="name" size="28"></td>
  14.                                                                                 </tr>
  15.                                                                                 <tr>
  16.                                                                                     <td align="right">Address:</td>
  17.                                                                                     <td><input type="text" name="address" size="28"></td>
  18.                                                                                 </tr>
  19.                                                                                 <tr>
  20.                                                                                     <td align="right">City:</td>
  21.                                                                                     <td><input type="text" name="city" size="28"></td>
  22.                                                                                 </tr>
  23.                                                                                 <tr>
  24.                                                                                     <td align="right">State:</td>
  25.                                                                                     <td><input type="text" name="state" size="5"> Zip:<input type="text" name="zip" size="11"></td>
  26.                                                                                 </tr>
  27.                                                                                 <tr>
  28.                                                                                     <td align="right">E-Mail:</td>
  29.                                                                                     <td><input type="text" name="emailAddress" size="28"></td>
  30.                                                                                 </tr>
  31.                                                                                 <tr>
  32.                                                                                     <td align="right">Select One:</td>
  33.                                                                                     <td></td>
  34.                                                                                 </tr>
  35.                                                                                 <tr>
  36.                                                                                     <td valign="top"></td>
  37.                                                                                     <td>
  38.                                                                                         <div align="left">
  39.                                                                                             <input type="radio" name="radiobutton" value="ordering" checked>Ordering<br>
  40.                                                                                             <input type="radio" name="radiobutton" value="comments">Comment(s)<br>
  41.                                                                                             <input type="radio" name="radiobutton" value="shipping">Shipping<br>
  42.                                                                                             <input type="radio" name="radiobutton" value="general">General<br>
  43.                                                                                             <input type="radio" name="radiobutton" value="catalog">Catalog Request</div>
  44.                                                                                     </td>
  45.                                                                                 </tr>
  46.                                                                                 <tr>
  47.                                                                                     <td align="right" valign="top">Comments:</td>
  48.                                                                                     <td></td>
  49.                                                                                 </tr>
  50.                                                                                 <tr>
  51.                                                                                     <td valign="top"></td>
  52.                                                                                     <td><textarea name="comments" rows="8" cols="30"></textarea></td>
  53.                                                                                 </tr>
  54.                                                                             </table>
  55.                                                                         </div>
  56.                                                                         <div align="center">
  57.                                                                             <p><input type="submit" name="Submit" value="Submit"> <input type="reset" value="Clear Form" name="reset"></p>
  58.                                                                         </div>
  59.                                                                     </form>
  60.                                                                         <?php
  61.    } else {
  62.       error_reporting(0);
  63.       $recipient = "jay-peezee@sbcglobal.net";
  64.       $subject = "Inquiry about " . $_POST["radiobutton"];
  65.       $msg .= $_POST["name"] . "n";
  66.       $msg .= $_POST["address"] . "n";
  67.       $msg .= $_POST["city"] . ", " . $_POST["state"] . ", " . $_POST["zip"] . "n";
  68.       $msg .= $_POST["comments"] . "n";
  69.       $from = $_POST["emailAddress"];
  70.             if (mail($recipient, $subject, $msg, $from))
  71.          echo nl2br("<br><center><b>Your Inquiry has been received.<br>Thank You !</b></center>");
  72.       else
  73.          echo "Message failed to send";
  74. }
  75. ?>

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Installation > Help with PHP FORM - im a n00b.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
Create the Optimal Architecture for your Critical Applications
Warburton's the largest independently owned bakery in the UK faced a number of difficult challenges in providing the most robust yet efficient IT infrastructure for their organization's success. IBM's services combined with their xSeries servers created the perfect platform for their SAP environment with sufficient flexibility, and did so in very time effective fashion.

Request Your Free Technology Downloads!
 
Five Best Practices for Deploying a Successful Service-Oriented Architecture
This white paper describes the benefits you can expect with SOA, and how IBM can help take your business there.

Request Your Free Technology Downloads!
 
Gartner Magic Quadrant for Application Delivery Controllers
Gartner summarizes its view on Application Delivery Controllers, evaluates strengths and weaknesses of solutions, and provides Magic Quadrant reporting for a quick comparison across all vendors. Learn from Gartner how you can benefit from an all-in-one device like Citrix NetScaler that delivers the highest levels of availability, performance and security.

Request Your Free Technology Downloads!
 
Knowledge is Power
What you don't know can hurt you, and is likely costing you money and increasing your security risks during an era of scarce resources. This white paper proposes six key strategies that enterprise security managers can use to improve their network defense posture.

Request Your Free Technology Downloads!
 
Rationalizing the Multi-Tool Environment
The rationalized multi-tool approach is flexible, scalable and cost effective. It provides the necessary input to the IT service management business processes. It preserves prior investments in monitoring tools, empowers technologists to select the best tools with which to do their jobs, and enhances effective response to incidents.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2010 by Developer Shed. All rights reserved. DS Cluster 10 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek