foolygoofy Posted December 14, 2007 Share Posted December 14, 2007 I have this form on my site that it was working until recently and that I have use for years. All of a sudden it stops working on all my sites. It works by the user arriving at the page “contact.php” where the user fills up the form and press send. Here is the code for that page in a simple form. <html> <head> <title>SITE TITLE</title> </head> <body> <form action="ContactSent.php" method="post"> Enter Name: <input name="name" type="text" id="name"> <input type="submit" name="Submit" value="Send"> </form> </body> </html> Once the user presses send, it is taken to another page. This new pages is “contactSent.php” where the user is told that his info was sent and then using php functions an email is generated and sent to the email that you set up in the php code. Here is the code for this page <html> <head> <title>SITE TITLE</title> </head> <body> <?php $ipi = getenv("REMOTE_ADDR"); $httprefi = getenv ("HTTP_REFERER"); $httpagenti = getenv ("HTTP_USER_AGENT"); ?> <input type=hidden name="ip" value="<?php echo $ipi ?>"> <input type=hidden name="httpref" value="<?php echo $httprefi ?>"> <input type=hidden name="httpagent" value="<?php echo $httpagenti ?>"> <?php $myemail = "USER@DESTINATIONYOUCHOOSE.COM"; if (!isset($email)) echo "$ip" ; $todayis = date("l, F j, Y, g:i a") ; $subject = "EMAIL SUBJECT"; $message = " Name: $name \n $ipi \n $todayis [EST] "; $from = "From: $myemail\r\n"; if ($myemail != "") mail($myemail, $subject, $message, $from); ?> message sent </body> </html> And so it stopped working partially. I get the email in the inbox, I see that variables values of the date, ip, etc. The only things I don’t see are the values inside of $message. I get would get any text typed inside the function, but not the value of the variables. I’m suppose to get something like this: Name: WHATEVER NAME IT WAS ENTERED Instead I just get Name: Going deeper in details, all the sites are hosted at different host companies. Thanks Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 14, 2007 Share Posted December 14, 2007 Your code is dependent on register globals being on (form field data magically appears in program variables.) You need to set the php program variables for every form field, like this - $name = $_POST['name']; ... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.