Jump to content

mail not working


Richard Principal

Recommended Posts

hi it seems the variable filled out on the HTML ar not passed over to the PHP page

<form method="post" action="processfeedback.php"><table><tr><td>Enter your name: <br /><input type="text" name="name" size="45" /><br /></td><td>Enter your email address:<br /><input type="text" name="email" size="45" /><br /></td></tr><tr><td colspan="2">Enter your feedback below:<br /><textarea name="feedback" rows="5" cols="80"></textarea><br /><br /><input type="submit" value="Click here to Email your comments." style="background-color:#ffff99" /></td></tr></table></form>

then on the processfeedback.phpis

<?    $name=trim($name);  $email=trim($email);  $feedback=trim($feedback);  $toaddress = "some@address.com";  // the default value    $subject = "Feedback from web site";  $mailcontent = "Name: ".$name."\n"				 ."Email: ".$email."\n"				 ."Comments: \n".$feedback."\n";  mail($toaddress, $subject, $mailcontent);  ?>

I wonder if a updated PHP version at the web site stops it working

Link to comment
Share on other sites

This is due to the setting of the "register_globals" configuration option. If register globals is on, variables inside $_GET, $_POST, $_COOKIE, $_SESSION etc are automatically imported into the global scope. But most servers disable register_globals for compatibility and security reasons, so you need to specifically get everything from $_POST yourself: $name=trim($_POST['name']); $email=trim($_POST['email']); $feedback=trim($_POST['feedback']);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...