mtmrop Posted August 10, 2009 Share Posted August 10, 2009 Hi, this is my first post on this forum and my first ever go at php...please be gentle with this complete noob! I'm putting some code together for a website, but have got a bit stuck. I need to be able to go to a different webpage after the php has finished it's job. In this case, the code updates a mySQL database (that bit works) but after that, I need the user to be returned to another page on the website. Can this be done? Chopped down version of the code is below... <?php $con = mysql_connect("localhost","xx","xx"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("xx", $con); mysql_query("UPDATE wTable SET wName = '$_POST[wName]' WHERE ID='$_POST[wid]'"); ?> What I want now is for the user to be sent to page mysite.com/admin.php Thanks in advance for any help! mtm Quote Link to comment Share on other sites More sharing options...
taquitosensei Posted August 10, 2009 Share Posted August 10, 2009 this is how you would redirect. header("Location: mysite.com/admin.php"); you'll want some validation code to determine whether or not to redirect Quote Link to comment Share on other sites More sharing options...
mtmrop Posted August 10, 2009 Author Share Posted August 10, 2009 taquitosensei: that's almost embarrassingly easy! So much googling around, but without knowing the keyword to search for, nothing was coming up. Thank you for the lightening speed response! 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.