javascript to php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
niekerk
Forum Newbie
Posts: 9
Joined: Fri Sep 26, 2003 11:20 am

javascript to php

Post by niekerk »

what is the php equivalent of this javascript please

Code: Select all

<script language="JavaScript" type="text/javascript">

function NextPage() &#123;

window.location.href="page2.php";
&#125;

</script>
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

Post by Straterra »

header("Location: page2.php")
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

you have to reload page1.php though :wink:
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

Post by Straterra »

No, you don't. That header redirect the page to whatever automatically.
Straterra
Forum Regular
Posts: 527
Joined: Mon Nov 24, 2003 8:46 am
Location: Indianapolis, Indiana
Contact:

Post by Straterra »

If you are wanting to call that url when you click on something without reloading, that cannot be done in PHP. That is a client side things and you have to use Javascript, or some other client side language.
niekerk
Forum Newbie
Posts: 9
Joined: Fri Sep 26, 2003 11:20 am

Post by niekerk »

thanks to all, i will go with the client side option
Post Reply