You are here: Re: go to URL « All PHP « IT news, forums, messages
Re: go to URL

Posted by Charlie on 06/18/06 16:29

J.O. Aho wrote:
> Java Buai wrote:
>
> As this has nothing to do with SQL, I added alt.php as newsgroup and set
> follow-up to alt.php too.
>
>
> > I am new to php but realy loving it . I would like my code to tell the
> > browser to load a new page at a given URL. In java you could create a
> > variable of type URL.

> >
> > It should work something like this.
> >
> > if (correct)
> > getURL(http://www.youarecorrect.com); //I want this line, if executed, to
> > open the given web page.
> > else
> > echo "Incorrect";
> >
> > How could I do this in php?
>
> <?PHP
> if($correct) {
> header("Location: http://www.example.com/");
> exit;
> }
> /* put what you want to do if not correct under here */
> ?>
>
>
> > (had to dump java because pop up blockers in ie complains about it)
>
> I suggest you dump it too and get a proper browser.

You would use the following code:
<?PHP
if($correct)
{
header("Location: http://website.ext");
}
else
{
/* Code to be executed if not correct */
}
?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация