scmeeker Posted March 22, 2011 Share Posted March 22, 2011 Perhaps I need another set of eyes on this but after Inserting into the Table (which that works fine), its not going to the next page: header("location:finalize.php"); It's inserting the new user, then staying on a blank page and not moving on to "finalize.php." Here is the code from the page: <?php session_start (); ?> <?php include('connect.php'); $username = mysql_real_escape_string($_POST[username]); $first_name = mysql_real_escape_string($_POST[first_name]); $last_name = mysql_real_escape_string($_POST[last_name]); $password = mysql_real_escape_string($_POST[password]); $membership = mysql_real_escape_string($_POST[membership]); $level = mysql_real_escape_string($_POST[level]); $terms = mysql_real_escape_string($_POST[terms]); $sql2="INSERT INTO user (first_name, last_name, username, password, membership, level, terms, date) VALUES ('$first_name', '$last_name', '$username', '$password', '$membership', '$level', '$terms', CURDATE())"; if (!mysql_query($sql2)) { die('Error: ' . mysql_error()); }else { header("location:finalize.php"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/231445-page-not-directing-to-new-page/ Share on other sites More sharing options...
PFMaBiSmAd Posted March 22, 2011 Share Posted March 22, 2011 Are you developing and debugging your code on a system with error_reporting set to E_ALL and display_errors set to ON so that php will report and display all the errors it finds? There would likely be an error that would indicate why the header() statement is not working. Quote Link to comment https://forums.phpfreaks.com/topic/231445-page-not-directing-to-new-page/#findComment-1191089 Share on other sites More sharing options...
scmeeker Posted March 23, 2011 Author Share Posted March 23, 2011 When I tested it out on my home server, it works fine but is not working "live." That's where its giving me problems. I have - ini_set('display_errors', 0); at the top of the page but no errors show up. Is there something else I should do to show the errors? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/231445-page-not-directing-to-new-page/#findComment-1191096 Share on other sites More sharing options...
scmeeker Posted March 23, 2011 Author Share Posted March 23, 2011 Yes, it's giving me this error: "Warning: Cannot modify header information - headers already sent " with the line #. Quote Link to comment https://forums.phpfreaks.com/topic/231445-page-not-directing-to-new-page/#findComment-1191109 Share on other sites More sharing options...
jcbones Posted March 23, 2011 Share Posted March 23, 2011 Make sure there are no spaces before the opening <?php tag, nor between any of the other opening/closing tags (better still, take them out). Quote Link to comment https://forums.phpfreaks.com/topic/231445-page-not-directing-to-new-page/#findComment-1191123 Share on other sites More sharing options...
scmeeker Posted March 23, 2011 Author Share Posted March 23, 2011 found it...finally! It was the fact that there were no quotes around the variable 'username' and so on. It's working fine now. $username = mysql_real_escape_string($_POST[username]); Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/231445-page-not-directing-to-new-page/#findComment-1191126 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.