Basically what I'm doing is an if.then.else and depending on a value in the DB it's supposed to load one page or another. Right now I have it kluged together with a submit button but I'd like it to load automatically.

This PHP script sits alone with no HTML output, it just searches the database for an item. If that item is found I want it to go to my page, otherwise I want it to go to a default page on another server.

All that aside, whether it's HTML, PHP, or Javascript I just need a command that allows me to force the browser to load a new page. I know it's easy I just can't seem to find what I'm looking for. I've found things that were close, but not right.

php header function or javascript's window.location

<?php
header('Location: http://www.yoursite.com/new_page.html');
?>

That *is* MARVELOUS! Thank you, it worked like a charm. After two days of beating my head against this problem it was such a beautiful sight to see it seamlessly load the correct page.

Thanks again!

David

That *is* MARVELOUS! Thank you, it worked like a charm. After two days of beating my head against this problem it was such a beautiful sight to see it seamlessly load the correct page.

Thanks again!

David

It worked great until I started putting code into it. :)

I chanced across this method
<?php
echo "<script>location.replace(\"http://192.168.1.56/welcome.htm\");</script>";
?>
using javascript. I think it'll work better. We'll have to see.

David

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.