xcali Posted February 23, 2008 Share Posted February 23, 2008 Hi guys being a noob i posted this in the wrong section before so here i go again >_< After my php code executes and everything is successful i would like it to jump to a different page. Is there an easy way to do it? for example : } ...SOME CODE HERE THAT VERIFIES EVERYTHING // If everything's okay. // Register the user in the database. require_once ('dbconnect.php'); // Connect to the db. // Make the query. $query = "INSERT INTO users (first_name, last_name, email, password, regis_as) VALUES ('$fn', '$ln', '$e', SHA('$p'), '$r' )"; $result = @mysql_query ($query); // Run the query. if ($result) { // If it ran OK. GO TO SOME LINK ? exit(); GO TO SOME LINK ? } else { // If it did not run OK. echo '<h1 id="mainhead">System Error</h1> <p class="error">You could not be registered due to a system error. We apologize for any inconvenience.</p>'; // Public message. echo '<p>' . mysql_error() . ' Query: ' . $query . '</p>'; // Debugging message. exit(); } mysql_close(); // Close the database connection. } else { // Report the errors. echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occurred: '; foreach ($errors as $msg) { // Print each error. echo " - $msg \n"; } echo '</p><p>Please try again.</p> so basically after it verified everything, added the user to a database i would like it to jump to a signupC.html (signup complete) would i put the code before exit(); or after? (its not a header or footer its a new site) or all the way down after the code Please advise Thank you Quote Link to comment Share on other sites More sharing options...
Bauer418 Posted February 23, 2008 Share Posted February 23, 2008 Before exit(), you would add: header('Location: signupC.html'); Quote Link to comment Share on other sites More sharing options...
xcali Posted February 23, 2008 Author Share Posted February 23, 2008 hmmm for some reason it doesn't want to display the page - it does run through the query flawlessly - adds a user and all the info and then i just get a blank page (doesn't even switch to header('../signupC.html'); any idea what could be wrong? ... if ($result) { // If it ran OK. header('../signupC.html'); exit(); ... Quote Link to comment Share on other sites More sharing options...
Bauer418 Posted February 23, 2008 Share Posted February 23, 2008 Poorly formatted code. You shouldn't have HTML outputting before or even during form processing. Read about it in the sticky posted in this forum. Quote Link to comment Share on other sites More sharing options...
xcali Posted February 23, 2008 Author Share Posted February 23, 2008 allright thank you 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.