Re: Open New URL window
| From: | Richard S. Crawford | Date: | Thu, 20 Sep 2007 00:17:30 +0000 |
| Subject: | Re: Open New URL window | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-262262@lists.php.net to get a copy of this message | ||
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 help each other get through this thing, whatever it is."
(Kurt Vonnegut, 1922 - 2007)
Attachment: [application/pgp-signature] This is a digitally signed message part. signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part. signature.asc