Jump to content

run a link


asmith

Recommended Posts

for one thing the code i gave will only generate one link, if you notice im just if'ing the href portion of a single link, but now i understand what your wanting

 

you can do it thru javascipt on the body tag onload event.

 

<body onload="window.location = '<? if ($a = "hello") { echo "http://yahoo.com";} else {echo "http://gmail.com";} ?>'>

Link to comment
https://forums.phpfreaks.com/topic/79072-run-a-link/#findComment-400173
Share on other sites

header won't work in the middle of the html , it should be at the top . before html begins

any special code that simply opens a link automaticlly anywhere on the page ? (PHP)

 

for one thing the code i gave will only generate one link, if you notice im just if'ing the href portion of a single link, but now i understand what your wanting

 

you can do it thru javascipt on the body tag onload event.

 

<body onload="window.location = '<? if ($a = "hello") { echo "http://yahoo.com";} else {echo "http://gmail.com";} ?>'>

 

it is a good code , but if the browser do not support java, it won't work .

 

Link to comment
https://forums.phpfreaks.com/topic/79072-run-a-link/#findComment-400175
Share on other sites

you can call header tags half way down a PHP file, if you use the Output Buffering code

 

<? ob_start();

... lots of content here....


$location = "location: http://www.gmail.com";
ob_clean();
header('HTTP/1.0 302 Found');
header($location);

?>

Link to comment
https://forums.phpfreaks.com/topic/79072-run-a-link/#findComment-400179
Share on other sites

header won't work in the middle of the html , it should be at the top . before html begins

any special code that simply opens a link automaticlly anywhere on the page ? (PHP)

 

It is ilogical to attempt to display data and then redirect. What is the point of displaying something if your simply going to redirect to another page?

 

I suggest you adjust your logic accordingly, or use the previously posted buffering hack.

Link to comment
https://forums.phpfreaks.com/topic/79072-run-a-link/#findComment-400183
Share on other sites

header won't work in the middle of the html , it should be at the top . before html begins

any special code that simply opens a link automaticlly anywhere on the page ? (PHP)

 

It is ilogical to attempt to display data and then redirect. What is the point of displaying something if your simply going to redirect to another

 

that's true, i just didn't want to rearrange codes !!

Link to comment
https://forums.phpfreaks.com/topic/79072-run-a-link/#findComment-400202
Share on other sites

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.