Relevancy Posted May 23, 2006 Share Posted May 23, 2006 Ok I have several sites using this send data script, but a new site got put on a server that has php5 and now the script is not working. It sends blank emails and doesnt not include the field data from the form.Here is the page with the form [a href=\"http://www.beyondfossilfuel.com/promote.html\" target=\"_blank\"]http://www.beyondfossilfuel.com/promote.html[/a]Here is the php code for the send data script:[code]<?php$contents = $HTTP_SERVER_VARS['REMOTE_ADDR'] . " just entered this data into the form: " . $HTTP_POST_VARS['pageName'] . "\n\n";//get the contents of the form from a postwhile(list($key, $value) = each($HTTP_POST_VARS)){ if($key == "sendto"){ $sendto = $value; } elseif($key == "redirectpage"){ $redirectpage = $value; } elseif($key == "subject"){ $subject = $value; } else { $contents .= "$key \t = \t $value \n"; }}//get the contents of a form from a getwhile(list($key, $value) = each($HTTP_GET_VARS)){ if($key == "sendto"){ $sendto = $value; } elseif($key == "redirectpage"){ $redirectpage = $value; } elseif($key == "subject"){ $subject = $value; } else { $contents .= "$key \t = \t $value \n"; } }//attach footer message$from_header = "From: Beyond Fossil Fuel";if($contents != ""){ //send mail - $subject & $contents come from surfer input mail($sendto, $subject, $contents, $from_header); // redirect back to url visitor came from header("Location: $redirectpage");} else{ print($contents); print("<HTML><BODY>Error, no data was submitted!"); print("</BODY></HTML>");}?>[/code]What do I need to change? I am not a php programmer at all. help! Quote Link to comment https://forums.phpfreaks.com/topic/10283-solved-send-data-php4-to-php5/ Share on other sites More sharing options...
wildteen88 Posted May 23, 2006 Share Posted May 23, 2006 I believe your new site that has PHP5 has a setting called [b]register_long_arrays[/b] turned off in the php.ini and so your [b]$HTTP_*_VAR[/b]'s are not being populated/recognised. In order for your script to work correctly take of the HTTP and _VAR bits in your variable names like so:$HTTP_POST_VAR become $_POST$HTTP_GET_VAR becomes $_GET$HTTP_SERVER_VAR becomes $_SERVERYou should use the much new superglobal arrays instead, which $_POST, $_GET, $_COOKIE, $_SESSION, $_SERVER etc. Quote Link to comment https://forums.phpfreaks.com/topic/10283-solved-send-data-php4-to-php5/#findComment-38313 Share on other sites More sharing options...
Relevancy Posted May 23, 2006 Author Share Posted May 23, 2006 Wonderful! I love you! Is that too much to say? jkThanks.. it worked great. Quote Link to comment https://forums.phpfreaks.com/topic/10283-solved-send-data-php4-to-php5/#findComment-38320 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.