dj_meatwad Posted November 8, 2007 Share Posted November 8, 2007 Hello - first off, please forgive me if this has already been answered. I was unable to find a solution by searching, but it's possible I didn't search on the correct terms. In any case, here's the issue: My hosting provider, Lunarpages, recently upgraded PHP from 4.4.4 to 4.4.7. I had a couple of HTML forms that were sending data to a PHP script, which used data from said HTML form to generate, and send, an email. After the upgrade to 4.4.7, however, the _POST variables in the PHP are not showing up in the generated email. I'll paste the code in here now; perhaps there's something I've done incorrectly: PHP code: <?php if ($_POST['user'] != "" && $_POST['requested'] ) { $subject="Request!"; $ip=$_SERVER["REMOTE_ADDR"]; $host = $ip; $mon=date(m); $day=date(j); $year=date(y); $hour=date(g); $min=date(i); $sec=date(s); $hour=$hour-2; if($hour<=0) { $hour+=12; } $ts = "$hour:$min:$sec on $mon/$day/$year"; $nsuser = stripslashes($user); $body=" Your Name = $nsuser Song Requested = $requested Dedication = $dedication Host: $host Time: $ts"; $email = "From: Form <$to>"; mail($to, $subject, $body, $email); header("Location: xxx.php"); } ?> ... and the HTML form that calls it: <form method="post" action="req_form.php"> Your Name (required):<br> <input type="text" name="user" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value=""><br> Song Requested (required, artist & song title please!):<br> <input type="text" name="requested" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value=""><br> Dedication? (may be read on air):<br> <input type="text" name="dedication" style="border: 1px solid #cccccc; background-color: #ffffff;" size="26" value=""><br> <input type="submit" value="send" style="border: 1px solid #cccccc; background-color: #ffffff;"> </form> With this, the email is generated and sent, with entirely blank fields, regardless of what the user enters into the form. Again, this worked just fine with PHP 4.4.4. Any help/advice/assistance anyone can provide here would be most appreciated. If more information is required, please let me know. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 8, 2007 Share Posted November 8, 2007 You register_globals setting was probably changed meaning your going to have to start defining your variables from forms actually using $_POST. So you would change lines like this $nsuser = stripslashes($user); To $nsuser = stripslashes($_POST['user']); Quote Link to comment Share on other sites More sharing options...
craygo Posted November 8, 2007 Share Posted November 8, 2007 Damn beat me to it LOL Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 8, 2007 Share Posted November 8, 2007 Damn beat me to it LOL Don't ya hate when that happens? haha Quote Link to comment Share on other sites More sharing options...
revraz Posted November 8, 2007 Share Posted November 8, 2007 If you have access to your PHP.INI, you can change it back. Quote Link to comment Share on other sites More sharing options...
dj_meatwad Posted November 8, 2007 Author Share Posted November 8, 2007 If you have access to your PHP.INI, you can change it back. I do, and I did. Thanks for all your help, folks. 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.