Jump to content

...after php executes just to a link?


xcali

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/92604-after-php-executes-just-to-a-link/
Share on other sites

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();

...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.