agent_x91
08-05-2005, 09:46 PM
I'm a little confused about PHP's $_POST. I thought I had a rough idea of how to use it but apparently not, because it ended up blank in my script after using a form action to redirect there. Can someone help? I've tried using a form in mailer.php to send the appropriate values to mail.php, which then sends it. However, $_POST items are appearing empty, so it's not sending a subject, messagecontents, from address, etc.
The source of the two files are below.
mailer.php:
<html>
<head>
</head>
<body>
<form action="mail.php" method="post">
<center>
<table>
<tr>
<td><center><b>Subject</b></center></td>
<td><center><input name="subject" size=30></center></td>
</tr>
<tr rowspan=5>
<td><center><b>Message</b></center></td>
<td><center><textarea name="contents" rows=5 cols=30></textarea></center></td>
</tr>
<tr>
<td><center><b>From</b></center></td>
<td><center><input name="nfrom" size=30></center></td>
</tr>
</table>
</center>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
mail.php:
<?php
$addrto="agent_of_oblivion_91@hotmail.com";
$namefrom=$_POST['nfrom'];
$subject=$_POST['subject'];
$contents=$_POST['contents'];
echo $namefrom;
$addcontents="A message has been sent from the mail script at http://hellfusion.freewebsitehost.net\n\n";
mail($addrto,$subject,$addcontents.$contents,"From:$namefrom");
?>
Any help would be appreciated.
The source of the two files are below.
mailer.php:
<html>
<head>
</head>
<body>
<form action="mail.php" method="post">
<center>
<table>
<tr>
<td><center><b>Subject</b></center></td>
<td><center><input name="subject" size=30></center></td>
</tr>
<tr rowspan=5>
<td><center><b>Message</b></center></td>
<td><center><textarea name="contents" rows=5 cols=30></textarea></center></td>
</tr>
<tr>
<td><center><b>From</b></center></td>
<td><center><input name="nfrom" size=30></center></td>
</tr>
</table>
</center>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
mail.php:
<?php
$addrto="agent_of_oblivion_91@hotmail.com";
$namefrom=$_POST['nfrom'];
$subject=$_POST['subject'];
$contents=$_POST['contents'];
echo $namefrom;
$addcontents="A message has been sent from the mail script at http://hellfusion.freewebsitehost.net\n\n";
mail($addrto,$subject,$addcontents.$contents,"From:$namefrom");
?>
Any help would be appreciated.