Jump to content

Forward to another page


PHPLRNR

Recommended Posts

<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

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.

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.

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>";

:P

 

you haven't escaped the double quotes:

echo "<a href=\"link\">link</a>";

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.
}
?>

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"])

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.