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 Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/ 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. Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-599417 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 Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-599419 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 Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-599429 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. Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-599436 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. Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-599438 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. Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-599962 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>"; Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-599964 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. Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-599980 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. } ?> Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-600022 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. Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-600024 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"]) Link to comment https://forums.phpfreaks.com/topic/116578-forward-to-another-page/#findComment-600030 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.