| | |
New to php and getting frustrated
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2005
Posts: 3
Reputation:
Solved Threads: 0
Hello,
I am trying to do a simple form (text fields only). The users enter, submit, then there is a confirmation page and information is sent to an email. When 'submit' is clicked there is no information returned from the $_POST variable. Here is the code:
[PHP]
$to="MyEmail@MyAddress.com";
$subject=$_POST['course'];
echo "<p>Thank you" $_POST['name'] "!<br>";
echo "Your assignment for" $_POST['course'] "has been submitted.";
//mail string to send to email
$msg = "NAME: " $_POST['name'];
$msg .= "LICENSE NO: " $_POST['license'];
$msg .= "EMAIL: " $_POST['email'];
$msg .= "DATE: " $_POST['mydate'];
$msg .= "QUESTION 1: " $_POST['q1'];
$msg .= "QUESTION 2:" $_POST['q2'];
$headers ="FROM: " $_POST['email'];
//set up mail
mail($to,$subject,$msg,$headers);
?>
[/PHP]
The form action and textfields values are correct. I get the "text" but nothing from the html form. Now, my remote host supports php, so thats not an issue. I am working in DWMX 2003, PHP 5.0.2, on WinXP pro.
I am getting very frustrated and could really use some expertise.
Thanks.
I am trying to do a simple form (text fields only). The users enter, submit, then there is a confirmation page and information is sent to an email. When 'submit' is clicked there is no information returned from the $_POST variable. Here is the code:
[PHP]
$to="MyEmail@MyAddress.com";
$subject=$_POST['course'];
echo "<p>Thank you" $_POST['name'] "!<br>";
echo "Your assignment for" $_POST['course'] "has been submitted.";
//mail string to send to email
$msg = "NAME: " $_POST['name'];
$msg .= "LICENSE NO: " $_POST['license'];
$msg .= "EMAIL: " $_POST['email'];
$msg .= "DATE: " $_POST['mydate'];
$msg .= "QUESTION 1: " $_POST['q1'];
$msg .= "QUESTION 2:" $_POST['q2'];
$headers ="FROM: " $_POST['email'];
//set up mail
mail($to,$subject,$msg,$headers);
?>
[/PHP]
The form action and textfields values are correct. I get the "text" but nothing from the html form. Now, my remote host supports php, so thats not an issue. I am working in DWMX 2003, PHP 5.0.2, on WinXP pro.
I am getting very frustrated and could really use some expertise.
Thanks.
•
•
Join Date: Feb 2005
Posts: 31
Reputation:
Solved Threads: 2
Whenever you use _POST make sure you preface the logic with a statement like:
if (isset(_POST['submit']) {
.
.
.
}
Now in your HTML form make sure you specify POST as the method. Generally speaking as long as your server is PHP enabled and the action statement in HTML points to your PHP script and the method is correct you should be good to go.
Let me know if you would like a simple sample of a HTML page that calls a PHP script.
if (isset(_POST['submit']) {
.
.
.
}
Now in your HTML form make sure you specify POST as the method. Generally speaking as long as your server is PHP enabled and the action statement in HTML points to your PHP script and the method is correct you should be good to go.
Let me know if you would like a simple sample of a HTML page that calls a PHP script.
•
•
•
•
Originally Posted by AMulligan
Hello,
I am trying to do a simple form (text fields only). The users enter, submit, then there is a confirmation page and information is sent to an email. When 'submit' is clicked there is no information returned from the $_POST variable. Here is the code:
[PHP]
$to="MyEmail@MyAddress.com";
$subject=$_POST['course'];
echo "<p>Thank you" $_POST['name'] "!<br>";
echo "Your assignment for" $_POST['course'] "has been submitted.";
//mail string to send to email
$msg = "NAME: " $_POST['name'];
$msg .= "LICENSE NO: " $_POST['license'];
$msg .= "EMAIL: " $_POST['email'];
$msg .= "DATE: " $_POST['mydate'];
$msg .= "QUESTION 1: " $_POST['q1'];
$msg .= "QUESTION 2:" $_POST['q2'];
$headers ="FROM: " $_POST['email'];
//set up mail
mail($to,$subject,$msg,$headers);
?>
[/PHP]
The form action and textfields values are correct. I get the "text" but nothing from the html form. Now, my remote host supports php, so thats not an issue. I am working in DWMX 2003, PHP 5.0.2, on WinXP pro.
I am getting very frustrated and could really use some expertise.
Thanks.
![]() |
Similar Threads
- system("ls") okay, system("cp") not. Why? (PHP)
- PHP / My SQL Web developer (Web Development Job Offers)
- Java or PHP? (IT Professionals' Lounge)
- New to php and getting frustrated (PHP)
- PHP > Alaric (PHP)
- IE is hijacked by http://th.msie.cc/index.php?aid=20035 (Viruses, Spyware and other Nasties)
Other Threads in the HTML and CSS Forum
- Previous Thread: Css ?
- Next Thread: extending Horizontal as well as vertical ????
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7





