Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 05-07-2009, 09:40 PM   #1 (permalink)
 
Newb Techie

Join Date: May 2009

Posts: 8

ironlion27 is on a distinguished road

Default 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!!!
ironlion27 is offline  
Old 05-08-2009, 08:29 AM   #2 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default 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
kmote is offline  
Old 05-08-2009, 11:08 AM   #3 (permalink)
 
Newb Techie

Join Date: May 2009

Posts: 8

ironlion27 is on a distinguished road

Default 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!
ironlion27 is offline  
Old 05-08-2009, 01:02 PM   #4 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default 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!
CrazeD is offline  
Old 05-08-2009, 01:22 PM   #5 (permalink)
 
Newb Techie

Join Date: May 2009

Posts: 8

ironlion27 is on a distinguished road

Default 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.
ironlion27 is offline  
Old 05-08-2009, 01:32 PM   #6 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: php e-mail form

Quote:
Originally Posted by ironlion27 View Post
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
kmote is offline  
Old 05-08-2009, 01:36 PM   #7 (permalink)
 
Newb Techie

Join Date: May 2009

Posts: 8

ironlion27 is on a distinguished road

Default Re: php e-mail form

This is what came back;

--------
Array ( )
--------
ironlion27 is offline  
Old 05-08-2009, 02:29 PM   #8 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default Re: php e-mail form

Quote:
Originally Posted by ironlion27 View Post
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
kmote is offline  
Old 05-08-2009, 03:20 PM   #9 (permalink)
 
Newb Techie

Join Date: May 2009

Posts: 8

ironlion27 is on a distinguished road

Default

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
ironlion27 is offline  
Old 05-08-2009, 03:31 PM   #10 (permalink)
 

Join Date: Jul 2005

Location: England

Posts: 2,159

kmote has a spectacular aura aboutkmote has a spectacular aura about

Default 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.
kmote is offline  
 
Closed Thread

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
php sorting mysql db using html form variable ibexpiotr Programming Discussions 1 04-28-2009 11:14 AM
PHP form murdocsvan Programming Discussions 7 03-11-2009 11:00 PM
PHP mail() function GordyMac Programming Discussions 15 02-07-2009 10:01 PM
Looking for php form input and display script linux1880 Programming Discussions 3 06-03-2008 10:23 PM
Need PHP and JavaScript Form Validation Scripts aetherh4cker Programming Discussions 2 01-06-2008 04:16 PM