Jumping to another PHP page.

General discussions related to php

Moderators: egami, macek, gesf

Post Reply

Tue Oct 08, 2002 3:25 am

You want some javascript that'll use the onChange or similar trigger to change the document.location value which will force it to jump to another page!

In short, that's javascript, not PHP ;)

New php-forum User
New php-forum User
Posts: 18
Joined: Fri Oct 04, 2002 8:09 pm

Sat Oct 12, 2002 1:52 pm

if your php code is in the middle of executing, i.e. it has not gotten to the user yet, there is a way. You can call the header function.

read more at:

you could have the user select from a form the page he or she wants to go to, the on the page that handles the form submit, you could do some logic, then have the page return the user to a specified place.

it does seem in your post however that you want to the page to respond to a users choice for a new page directly, without the need for any other logic, at which point you should use javascript:

Code: Select all

<form action="choosepage.php">
    <select name="goto">
        <option value="http://yoursite/page1.html">



Code: Select all


$goto = $_POST['goto']

$others = $_POST[...];

... perform action on $other variables

header( "Location: $goto" );


Post Reply