outchy Posted August 18, 2008 Share Posted August 18, 2008 I was wondering if there's a way to have a form page automatically redirect to a different url after a successful post to the database, instead of just showing the text "1 show added". Here is the code: <?php $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("nik", $con); $sql="INSERT INTO test (dateofshow, headliner, place, opener) VALUES (CONCAT('$_POST[year]','-','$_POST[month]','-','$_POST[day]'),'$_POST[headliner]','$_POST[place]','$_POST[opener]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 show added"; mysql_close($con) ?> Quote Link to comment Share on other sites More sharing options...
trq Posted August 18, 2008 Share Posted August 18, 2008 header("Location: success.php"); Quote Link to comment Share on other sites More sharing options...
outchy Posted August 18, 2008 Author Share Posted August 18, 2008 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.