php e-mail form

Status
Not open for further replies.

ironlion27

Solid State Member
Messages
8
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!!!
 
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!
 
On the sendit.php page, please put the following:

PHP:
echo '<br />--------<br />';
print_r($_POST);
echo '<br />--------<br />';

And paste back what is between the -'s.
 
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.
 
What should be in place of the ----'s?

Nothing, CrazeD would like to see what is in $_POST so instead of
PHP:
<?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:
<?php 
echo '<br />--------<br />';
print_r($_POST);
echo '<br />--------<br />'; 
?>
 
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?
 
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.
 
Status
Not open for further replies.
Back
Top Bottom