ball420 Posted June 20, 2007 Share Posted June 20, 2007 i want to have the succes echo a particular web page not a link to the pae i have tried a few combinations but all with errors. here is my success code //check if query successful if($result){ echo "Successful"; echo "<BR>"; echo "<a href='viewguestbook.php'>View guestbook</a>"; // link to view guestbook page } else { echo "ERROR"; } mysql_close(); Quote Link to comment https://forums.phpfreaks.com/topic/56406-solved-if-succees-go-here/ Share on other sites More sharing options...
chigley Posted June 20, 2007 Share Posted June 20, 2007 header("Location: viewguestbook.php"); Quote Link to comment https://forums.phpfreaks.com/topic/56406-solved-if-succees-go-here/#findComment-278567 Share on other sites More sharing options...
thefortrees Posted June 20, 2007 Share Posted June 20, 2007 If you use header() you need to be sure that the header function is called BEFORE any HTML is sent to the browser, otherwise it won't work. Quote Link to comment https://forums.phpfreaks.com/topic/56406-solved-if-succees-go-here/#findComment-278569 Share on other sites More sharing options...
ball420 Posted June 20, 2007 Author Share Posted June 20, 2007 i'm sorry i'm a newbie and having a little trouble can someone explain Quote Link to comment https://forums.phpfreaks.com/topic/56406-solved-if-succees-go-here/#findComment-278605 Share on other sites More sharing options...
chigley Posted June 20, 2007 Share Posted June 20, 2007 //check if query successful if($result){ header("Location: viewguestbook.php); } else { echo "ERROR"; } mysql_close(); Note that you can't echo anything before that header() though. Otherwise you'll have to use ob_start(). Quote Link to comment https://forums.phpfreaks.com/topic/56406-solved-if-succees-go-here/#findComment-278608 Share on other sites More sharing options...
ball420 Posted June 20, 2007 Author Share Posted June 20, 2007 i'm getting an error on line 39 but it all looks right to me //check if query successful if($result){ header("Location: restaurant.php); //do i have to specify a url?? or just the page } else { //this is line 39 echo "ERROR"; } mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/56406-solved-if-succees-go-here/#findComment-278651 Share on other sites More sharing options...
ball420 Posted June 20, 2007 Author Share Posted June 20, 2007 i solved it forgot the " at the end of the restaurant.php another mission completed Quote Link to comment https://forums.phpfreaks.com/topic/56406-solved-if-succees-go-here/#findComment-278657 Share on other sites More sharing options...
chigley Posted June 20, 2007 Share Posted June 20, 2007 <?php //check if query successful if($result){ header("Location: restaurant.php"); //do i have to specify a url?? or just the page } else { //this is line 39 echo "ERROR"; } mysql_close(); ?> Missed your closing " Quote Link to comment https://forums.phpfreaks.com/topic/56406-solved-if-succees-go-here/#findComment-278658 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.