Click to See Complete Forum and Search --> : Form processing
ChrisBrown
12-17-2003, 05:13 PM
Here's the scoop:
I have a form in an .asp file. I am telling the file to send the form to a php file to be processed.
Now I thought that when a php file receives form data, it automatically creates the corresponding variables.
When I try to process the form, I get these errors:
Undefined variable: prospectName in C:\Inetpub\wwwroot\PrimaryhubHosting\Union_Digital_sites\udm2\root\processInfoRequest.php on line 11
This happens for each variable
Is it because a php file isn't originating the form?
No, that should make no difference at all. When you submit a form (either GET or POST) a request is sent to the server with the variables attached. PHP should not have a problem reading them. We'd have to see your code to help you further, or you could take a look at http://www.webdevfaqs.com/php.php#mailer
ChrisBrown
12-17-2003, 05:17 PM
Do you want the php file that processes the code?
Yes, that would be a good place to start.
ChrisBrown
12-17-2003, 05:27 PM
Here is the php code that processes the information:
"<?php
// This script takes the items from the form
// and then places them into a pre-made email
// and then sends it to the specified recipient
mail("sales@starlightranchhomes.com", "Web Request Information Form",
"This request for information came from your website:
Name: $prospectName
Question: $question
Email Address: $email
Phone Number: $phone
");
//Confirmation Screen Here For The User
?>"
Register_globals (http://www.webdevfaqs.com/php.php#globalvariables), I'd be willing to bet.
Try this, if you are using the post method for the form. If you are using get, swap out all the $_POST for $_GET.
<?php
// This script takes the items from the form
// and then places them into a pre-made email
// and then sends it to the specified recipient
mail("sales@starlightranchhomes.com", "Web Request Information Form",
"This request for information came from your website:
Name: ".$_POST['prospectName']."
Question: ".$_POST['question']."
Email Address: ".$_POST['email']."
Phone Number: ".$_POST['phone']."
");
//Confirmation Screen Here For The User
?>