Mailinglisten-Archive |
> Wie kann ich mittels PHP den Brwoser dazu bringen, je nach Wert einer
> Variable eine bestimmte URL anzuzeigen, bzw. im Browser zu öffenen.
>
> Nach dem Besipiel: Wenn x=treu, dann öffne www.xyz.com, wenn
> x = false, dann
> öffne www.abc.com ?
>
> Vielen Dank für die Hilfe
Versuchs mal folgendermaßen:
<?php
if (x) {
header ("Location: http://www.xyz.com");
} else {
header ("Location: http://www.abc.com");
}
?>
das setzt natürlich vorraus, dass zuerst eine PHP-Seite geladen wurde.
oder du probierst es direct im HEAD:
<html>
<head>
<?php
if (x) {
$target="http://www.xyz.com";
} else {
$target="http://www.abc.com";
}
?>
<meta http-equiv="refresh" content="0; URL=<?php print $target ?>">
</head>
meiner meinung nach ist die erste lösung eleganter...
jens
[jens reinemuth * adelungstr. 39 * 64283 darmstadt * 06151-10 10 45]
--
"I heard if you play the Windows-2000-CD backwards, you get a satanic
message"
"That´s nothing, if you play it forward, it installs Windows 2000!!!"
---------------------------------------------------------------------
php::bar PHP Wiki - Listenarchive