PHPLRNR Posted July 25, 2008 Share Posted July 25, 2008 Hi, Is there any other way to forward from one page to another page in PHP except header( 'Location: http://www.mysite.net/mypage.htm' ) and using <META> tag. Thanks Quote Link to comment Share on other sites More sharing options...
MFHJoe Posted July 25, 2008 Share Posted July 25, 2008 I don't think so. But you could use a .htaccess file if you're allowed to use it on your server. That can be used for page redirects as well as lots of other things. Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted July 25, 2008 Share Posted July 25, 2008 echo "<a href="link">link</a>"; ---------------- Now playing: Red Hot Chili Peppers - This Velvet Glove via FoxyTunes Quote Link to comment Share on other sites More sharing options...
secoxxx Posted July 25, 2008 Share Posted July 25, 2008 <script type="text/javascript"> <!-- function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'"); } //--> </script> and <body onload="MM_goToURL('parent','view.php');return document.MM_returnValue"> just change view.php to whatever you want Quote Link to comment Share on other sites More sharing options...
PHPLRNR Posted July 25, 2008 Author Share Posted July 25, 2008 Actually I want it without using JavaScript. Quote Link to comment Share on other sites More sharing options...
MFHJoe Posted July 25, 2008 Share Posted July 25, 2008 Create a file called .htaccess (just .htaccess, no filename) and put the following code in it. Then upload it to the directory you need it to be in. Obviously you'll have to change the oldpage.htm and newpage.htm to your requirements. Redirect oldpage.htm newpage.htm If this isn't what you want, you'll have to use JavaScript or meta tags. Or LemonInflux's method which to be honest is probably the best one so far. Quote Link to comment Share on other sites More sharing options...
PHPLRNR Posted July 26, 2008 Author Share Posted July 26, 2008 I want to forward from one page to another page in a conditon like below <?php $chk = $_POST["jschk"]; if ($chk != '1') { header( 'Location: http://www.mysite.net/mypage.php' ) ; } ?> but whatever the value of chk, page forward to mypage.php. How I will forward to this page in specific condition. Quote Link to comment Share on other sites More sharing options...
MasterACE14 Posted July 26, 2008 Share Posted July 26, 2008 I want to forward from one page to another page in a conditon like below <?php $chk = $_POST["jschk"]; if ($chk != '1') { header( 'Location: http://www.mysite.net/mypage.php' ) ; } ?> but whatever the value of chk, page forward to mypage.php. How I will forward to this page in specific condition. You've just answered your own question... echo "<a href="link">link</a>"; you haven't escaped the double quotes: echo "<a href=\"link\">link</a>"; Quote Link to comment Share on other sites More sharing options...
PHPLRNR Posted July 26, 2008 Author Share Posted July 26, 2008 I don't want to show my current page means where above code exist. I just want to forward in a new page when condition satify. Quote Link to comment Share on other sites More sharing options...
MFHJoe Posted July 26, 2008 Share Posted July 26, 2008 Could you not just add an else clause to your if statement? <?php $chk = $_POST["jschk"]; if ($chk != '1') { // If the condition is satisfied, the page is redirected and NOT displayed header( 'Location: http://www.mysite.net/mypage.php' ) ; } else { // If the condition is not satisfied, the page is displayed // here. } ?> Quote Link to comment Share on other sites More sharing options...
unkwntech Posted July 26, 2008 Share Posted July 26, 2008 To MFHJoe in this case the else is not necessary. Quote Link to comment Share on other sites More sharing options...
MFHJoe Posted July 26, 2008 Share Posted July 26, 2008 To MFHJoe in this case the else is not necessary. Right. I didn't really think about that before I posted it... Anyway, I think I've found the actual problem now. Checkboxes are not set if they are not checked, and when they are checked they return the value 'on' instead of 1. So this will be why the if statement isnt going through. Use: if (isset($_POST["jschk"]) 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.