...

View Full Version : Web form not passing POST data?



jessnoonyes
10-23-2009, 11:50 PM
Hi everyone! I have a contact form that I'm trying to add fields to, but for some reason the information that's added into them isn't passed to the PHP script and mailed to me. Or perhaps there's something in the script that's messing it up. I've been playing with this for hours and I can't figure it out. Any help would be greatly appreciated!

At the top of my script I have some variables
if(!$_POST) exit;


$name = $_POST['name'];
$email = $_POST['email'];
$company = $_POST['company'];
$streetaddress = $_POST['streetaddress'];
$comments = $_POST['comments'];
$verify = $_POST['verify'];

For some reason it won't pick up the 'company' or 'streetaddress'.

My form inputs for those:


<label for="company">Company:</label>
<input name="company" type="text" id="company" size="30" value="" />

<label for="streetaddress">Street Address:</label>
<input name="streetaddress" type="text" id="streetaddress" size="30" value="" />

Further down in the script it takes the data from the form and puts it into a nice message to be emailed.


$e_reply = "Name: $name\r\n\n";
$e_email = "Email Address: $email\r\n\n";
$e_phone = "Phone Number: $phone\r\n\n";
$e_company = "Company Name: $company\r\n\n";
$e_address = "Street Address: $streetaddress\r\n\n";

$msg = $e_reply . $e_email . $e_phone . $e_company . $e_address;

I think somewhere in one of those sections I'm screwing up. It will send the message part "Company Name:" but then it's blank, no matter what I do.

Does anyone know what I'm doing wrong? Thank you for any help!

Fumigator
10-23-2009, 11:55 PM
What does your form tag look like? Ya know you could just post the entire script, the problem is probably in an area you're not focusing on but we can't know this unless we see the whole thing.

jessnoonyes
10-24-2009, 01:53 AM
I was trying not to because it's a script I got on themeforest...Thank you for your help though!


<form method="post" action="sendout.php" name="contactform" id="contactform">
<label for="name"><span class="required">*</span>Name:</label>
<input name="name" type="text" id="name" size="30" value="" />

<label for="email"><span class="required">*</span>Email Address:</label>
<input name="email" type="text" id="email" size="30" value="" />

<label for="company">Company:</label>
<input name="company" type="text" id="company" size="30" value="" />

<label for="streetaddress">Street Address:</label>
<input name="streetaddress" type="text" id="streetaddress" size="30" value="" />

...yada yada

<input type="submit" class="submit" id="submit" value="Submit" />



if(!$_POST) exit;

$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$company = $_POST['company'];
$streetaddress = $_POST['streetaddress'];
$city = $_POST['city'];
$fax = $_POST['fax'];
$comments = $_POST['comments'];
$verify = $_POST['verify'];

...yada yada

$e_subject = 'You\'ve been contacted by ' . $name . '.';


$e_body = "You have been contacted by $name. Their additional message is as follows.\r\n\n";
$e_content = "\"$comments\"\r\n\n";
$e_reply = "Name: $name\r\n\n";
$e_email = "Email Address: $email\r\n\n";
$e_phone = "Phone Number: $phone\r\n\n";
$e_company = "Company Name: $company\r\n\n";
$e_address = "Street Address: $streetaddress\r\n\n";
$e_city = "City, State, Zip: $city\r\n\n";

$msg = $e_body . $e_content . $e_reply . $e_email . $e_phone . $e_company . $e_address . $e_city;

tomws
10-24-2009, 03:58 AM
I'm wondering what's missing in the "yada yada" portions. Is the form processor/mailer one of the pre-built form mailers or your own? FWIW, I doubt anyone could complain about posting the form's HTML since there's not really anything proprietary about forms and input.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum