Discussion: Open New URL window
Afficher un message
Vieux 20/09/2007, 01h17   #3
Richard S. Crawford
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] Open New URL window

On Wednesday 19 September 2007 15:50:08 Andrew Prostko wrote:
> My problem is, I do not know how to make the Else statement...
> How do I get it to open a new url?
> I want it IF yes open this page, else open this page


Andrew,

try the header() function:

<?php

if ($_POST['pw'] != $password) {

?>

...show your form...

<?php

} else {

header ("otherpage.php");

}

One problem you might be having is that the < body > tag at the very top might
be sending headers to your browser before your else statement has a chance to
kick in, generating an error which reads something like, "Headers already
sent..." Try moving it to after the conditional, like this:

<?php

if ($_POST['pw'] != $password) {

?>

< BODY onLoad="top.window.focus()" >

...rest of your form...

<?php

} else {

...and so on.


--
Richard S. Crawford
Editor-in-chief, Daikaijuzine (http://www.daikaijuzine.com)
Personal website: http://www.mossroot.com
http://www.myspace.com/underpope / underpope.livejournal.com
"We are here to each other get through this thing, whatever it is."
(Kurt Vonnegut, 1922 - 2007)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQBG8bwj0Q4njIwYM+oRAnx7AJ9Mdo/5qjv+GfAhZQEaQAEmmw46ywCfQ/g+
DIMmu/4IGtcWWZEU97Y7o0E=
=RGOr
-----END PGP SIGNATURE-----

  Réponse avec citation
 
Page generated in 0,06282 seconds with 9 queries