Posting/Jumping to a web page programatically

I only know of 2 main methods of jumping to a different web page from within a php script:-

  1. Clicking a link eg print(‘<a href=“index.htm”>Home</a>’);
  2. Clicking the Submit button in a form roughly like:-


?> <form method=‘post’ action=‘newpage.htm’>
<input type=“text” name=“email” size=40>

<input type=“submit” value=" Send ">
etc etc

I would like to be able to have a script which can navigate to a new site in response to an IF statement not involving operator intervention. Something like this:-

if ( $a > $b) {
" jump-to-otherpage.php"

Question: How do I code the quoted actions above? Is there perhaps, an effective function like "Exec(“newpage.htm”, $params); ?

header (“Location: jump-to-newpage.html”); exit;

Hi wonshikee

Sounds interesting - could you provide a snippet of code please.

$a = 1;
$b = 2;
if($a < $b){

Hi wonshikee & Anthony Sterling

Many thanks for your help - it is so easy. I’ve been delving everywhere for this trick: where can you look up this sort of stuff?

You’re staring at it.