Page 1 of 1

javascript to php

Posted: Wed Jan 14, 2004 2:55 pm
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>

Posted: Wed Jan 14, 2004 2:58 pm
by Straterra
header("Location: page2.php")

Posted: Wed Jan 14, 2004 3:05 pm
by basdog22
you have to reload page1.php though :wink:

Posted: Wed Jan 14, 2004 3:07 pm
by Straterra
No, you don't. That header redirect the page to whatever automatically.

Posted: Wed Jan 14, 2004 3:09 pm
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.

Posted: Wed Jan 14, 2004 3:24 pm
by niekerk
thanks to all, i will go with the client side option