944,122 Members | Top Members by Rank

Ad:
Jan 18th, 2005
0

New to php and getting frustrated

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
AMulligan is offline Offline
3 posts
since Jan 2005
Jan 18th, 2005
0

Re: New to php and getting frustrated

Oops, this is a bad way to start out...I have posted this in the wrong forum.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
AMulligan is offline Offline
3 posts
since Jan 2005
Feb 23rd, 2005
0

Re: New to php and getting frustrated

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.
Quote 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.
Reputation Points: 10
Solved Threads: 3
Light Poster
mcldev is offline Offline
31 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Css ?
Next Thread in HTML and CSS Forum Timeline: extending Horizontal as well as vertical ????





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC