I am having problems in my php code. I am relatively new to php but I
know some basics.
This is the problem:
when i try to echo some information that is typed into form back to
the screen i get absolutely nothing. It seems like $_POST['name'] is
an empty string, along with $_POST and $_GET['name'].
I looked around to see if someone else had the same problem and found
that some people's code didn't work because of IE6. but i also tried
mine on Netscape and i got the same problem.
So why is $_POST empty after posting information. Even $_GET was
empty.
any help is appreciated.
all of those returned empty
echo $_POST;
echo $_POST['name'];
echo $_GET['name'];
here is the code:
the code was originially meant to send an email but i commented the if
statement out to see why it wasn't working
<html>
<head><title>Feedback</title></head>
<body>
<?php
// Handle POST method.
//if ($_POST)
//{
$name = $_POST['name'];
$email = $_POST['email'];
$comments = $_POST['comments'];
// Compose simple text message:
$message = "Message from $name
($email)\n\nComments:\n\n$comments";
// Send message to bo*@microsoft.com
mail("em***@email.com", "Feedback", $message);
// Thank the generous user
echo "<h1>Cheers!</h1>\n";
echo $_POST;
echo $_POST['name'];
echo $_GET['name'];
// }
//else
//{
echo($_POST);
echo($_POST['name']);
// mail("kr******@hotmail.com", "Feedback", $message);
echo("yo");
?>
<h1>Feedback</h1>
<form action="<?=$PHP_SELF ?>" method="Post">
<p>Name: <input type="text" name="name" /></p>
<p>Email: <input type="text" name="email" /></p>
<p>Comments:</p>
<p><textarea name="comments"></textarea></p>
<p><input type="submit" value="Send!" /></p>
</form>
<?php
// }
?>
</body>
</html>