|  | |
05-07-2009, 09:40 PM
|
#1 (permalink)
|
Newb Techie Join Date: May 2009 Posts: 8
| php e-mail form Hey guys, I'm trying to set up a a fairly simple e-mail form using Dreamweaver. I have set the form fields and have made the simple .php script file to process. The problem is when I test it none of the values that are entered by the user come through. See examples below.
First- This is the .php file (minus my e-mail address): Code: <?php
$name = $_POST['Name'];
$email = $_POST['E-mail'];
$team = $_POST['Team'];
$service = $_POST['Service Type'];
$goal = $_POST['goal'];
$message = "Team: $team\n Service: $service \n Goal: $goal";
$header = "Name: $name E-mail: $email";
mail ( "e-mail", "Quote Request", $message, $header)
?>
And this is what I get e-mailed to me even after I enter values in all of the fields:
Team:
Service:
Goal:
Please help!!! |
| |
05-08-2009, 08:29 AM
|
#2 (permalink)
|
Join Date: Jul 2005 Location: England Posts: 2,159
| Re: php e-mail form Please post your form code.
__________________ MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11 
There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page |
| |
05-08-2009, 11:08 AM
|
#3 (permalink)
|
Newb Techie Join Date: May 2009 Posts: 8
| Re: php e-mail form Here is my Form Code:
<p><strong>Get a Quote</strong></p>
<form action="/sendit.php" method="post" enctype="text/plain" name="Quote" id="Quote">
<label>Name
<input type="text" name="Name" id="Name" />
</label>
<p>
<label>E-mail
<input type="text" name="E-mail" id="E-mail" />
</label>
</p>
<p>
<label>Team
<input type="text" name="Team" id="Team" />
</label>
</p>
<p>
<label>Age
<input name="Age" type="text" id="Age" size="3" />
</label>
</p>
<p>
<label>Service Type
<select name="Service Type" id="Service Type">
<option value="Video Analysis">Video Analysis</option>
<option value="Nutritional Plan">Nutritional Plan</option>
<option value="Fitness Plan">Fitness Plan</option>
<option value="1-on-1 Training (only OC/LA)">1-on-1 Training (only OC/LA)</option>
</select>
</label>
</p>
<p>
<label>Give me a quick Description of your goal
<br />
<textarea name="goal" id="goal" cols="45" rows="10"></textarea>
<br />
<br />
<input type="submit" name="Submit Quote Request" id="Submit Quote Request" value="Submit" />
<br />
</label>
</p>
</form>
Thanks for taking a look! |
| |
05-08-2009, 01:02 PM
|
#4 (permalink)
|
Wizard Techie Join Date: Feb 2006 Location: Maine Posts: 3,683
| Re: php e-mail form On the sendit.php page, please put the following: PHP Code: echo '<br />--------<br />'; print_r($_POST); echo '<br />--------<br />';
And paste back what is between the -'s.
__________________ Need website help? PM me! |
| |
05-08-2009, 01:22 PM
|
#5 (permalink)
|
Newb Techie Join Date: May 2009 Posts: 8
| Re: php e-mail form What should be in place of the ----'s? I tried as below but got the Parse error: syntax error for the line echo '<br />$message<br />';
<?php
$name = $_POST['Name'];
$email = $_POST['E-mail'];
$team = $_POST['Team'];
$service = $_POST['Service Type'];
$goal = $_POST['goal'];
$message = "Team: $team\n Service: $service \n Goal: $goal";
$header = "Name: $name E-mail: $email";
mail ( "ironlion27@gmail.com", "Quote Request", $message, $header)
echo '<br />$message<br />';
print_r($_POST);
echo '<br />$message<br />';
?>
p.s. this probably is a really silly mistake but I just can't figure this out. Thanks for your help. |
| |
05-08-2009, 01:32 PM
|
#6 (permalink)
|
Join Date: Jul 2005 Location: England Posts: 2,159
| Re: php e-mail form Quote:
Originally Posted by ironlion27 What should be in place of the ----'s? | Nothing, CrazeD would like to see what is in $_POST so instead of PHP Code: <?php
$name = $_POST['Name'];
$email = $_POST['E-mail'];
$team = $_POST['Team'];
$service = $_POST['Service Type'];
$goal = $_POST['goal'];
$message = "Team: $team\n Service: $service \n Goal: $goal";
$header = "Name: $name E-mail: $email";
mail ( "e-mail", "Quote Request", $message, $header)
?> have PHP Code: <?php
echo '<br />--------<br />';
print_r($_POST);
echo '<br />--------<br />';
?>
__________________ MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11 
There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page |
| |
05-08-2009, 01:36 PM
|
#7 (permalink)
|
Newb Techie Join Date: May 2009 Posts: 8
| Re: php e-mail form This is what came back;
--------
Array ( )
-------- |
| |
05-08-2009, 02:29 PM
|
#8 (permalink)
|
Join Date: Jul 2005 Location: England Posts: 2,159
| Re: php e-mail form Quote:
Originally Posted by ironlion27 This is what came back;
--------
Array ( )
-------- | OK so $_POST is not being set, could be because you are using the <label> tag incorrectly in your form code. Correct (or remove) that and check again.
__________________ MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11 
There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page |
| |
05-08-2009, 03:20 PM
|
#9 (permalink)
|
Newb Techie Join Date: May 2009 Posts: 8
| This is my html code w/ a revised label line. Does this look right? I ran the submit with the original php and got a syntax error on line 2 which is : $name = $_POST['Name'];
<p><strong>Get a Quote</strong></p>
<form action="/sendit.php" method="post" enctype="text/plain" name="Quote" id="Quote">
<label for="Name">Name
<input type="text" name="Name" id="Name" />
</label>
<p>
<label for="E-mail">E-mail
<input type="text" name="E-mail" id="E-mail" />
</label>
</p>
<p>
<label for="Team">Team
<input type="text" name="Team" id="Team" />
</label>
</p>
<p>
<label for="Age">Age
<input name="Age" type="text" id="Age" size="3" />
</label>
</p>
<p>
<label for="Service Type">Service Type
<select name="Service Type" id="Service Type">
<option value="Video Analysis">Video Analysis</option>
<option value="Nutritional Plan">Nutritional Plan</option>
<option value="Fitness Plan">Fitness Plan</option>
<option value="1-on-1 Training (only OC/LA)">1-on-1 Training (only OC/LA)</option>
</select>
</label>
</p>
<p>
<label for="goal">Give me a quick Description of your goal
<br />
<textarea name="goal" id="goal" cols="45" rows="10"></textarea>
<br />
<br />
<input type="submit" name="Submit Quote Request" id="Submit Quote Request" value="Submit" />
<br />
</label>
</p>
</form>
This is the original php page that I'm using again. With the syntax error on line 2.
<? php
$name = $_POST['Name'];
$email = $_POST['E-mail'];
$team = $_POST['Team'];
$service = $_POST['Service Type'];
$goal = $_POST['goal'];
$message = "Team: $team\n Service: $service \n Goal: $goal";
$header = "Name: $name E-mail: $email";
mail ("ironlion27@gmail.com", "Quote Request", $message, $header)
?>
o scratch that, i fixed then syntax error but still getting in my e-mail:
Team:
Service:
Goal:
with no values. I must have used the <label> tag incorrectly in the html file. help?
Last edited by Baez; 05-08-2009 at 08:56 PM.
Reason: double
|
| |
05-08-2009, 03:31 PM
|
#10 (permalink)
|
Join Date: Jul 2005 Location: England Posts: 2,159
| Re: php e-mail form No, those labels are still wrong, they shouldn't be right the way around the form elements. Where you have Code: <label for="Name">Name
<input type="text" name="Name" id="Name" />
</label>
it should be Code: <label for="Name">Name</label>
<input type="text" name="Name" id="Name" />
EDIT: See HTML label tag and also don't double post.
__________________ MSI P43 Neo|Enermax Pro82+ 425W|E5200|silent 8500GT|250GB Samsung spinpoint F1|Samsung SATA DVD RW|4GB Corsair|Antec SOLO|openSUSE11 
There are in order of increasing severity: lies, darn lies, statistics, and computer benchmarks. - diskinfo man page
Last edited by kmote; 05-08-2009 at 03:36 PM.
|
| |  | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | |