Gud day everyone!!!

I hope you could help me with this one,


I have a select form that looks like this,

<select>
<option>AAA</option>
<option>BBB</option>
<option>CCC</option>
<option>DDD</option>
<option>EEE</option>
</select>
my question is, how to transfer to a new page if the select is change coz the page i am working right now requires that everytime the select is change it must transfer to a new page....

I am currently working with html and php right now and no javascript. I hope you could help me with this one.. I am just new to webpage...

THANK YOU IN ADVANCE... your help is highly appreciated...

Recommended Answers

All 10 Replies

You will need to use something like Javascript of AJAX or something that can be run client side. PHP is a server side language that is executed on the server computer before the users web browser receives the html (which is why you never see php code when you view source of a webpage). You need a script that can run on the users computer (the client computer) to redirect them when they make a selection.

U hav to use Java script, its simple only .Just call a function on "Onchange" that diverts page to other location . If not  u should use a form with a submit button.So wen te button got submitted it will direct to oter page

thanks, for the great help!!!

i have another problem with regards to onchange event of select (SELECT) form....

i have the following code like this one,

<select>
<option>red</option>
<option>green</option>
<option>blue</option>
<select>

my question is that, how can i redirect my page on same page by changing the background of the page depending on the value of the select.

If for example, i chooses the red option(RED) then after that the background color of my page will turn to the color based on the value of the option.


Thanks for any help and thanks in advanced!!!

You should look into using POST or GET methods with PHP to get info on what was sent to the page ("red", "green", or "blue") and then use sessions to save this data until viewer leaves the page.

Forms in HTML are designed to be used as follows: A form has a bunch of inputs, each with a name and a value (which the user sets), and a submit button which redirects the page to where ever is specified, and the data in all of the inputs is sent as well. PHP is a good language to retrieve this data and make use of it.

I suggest looking up a few tutorials with data retrieval like this. I'm too slack to find you any links so google away.

You can do what the other posters said of course..
but what you want to do can easily be done the way you want to.
Look up redirect, there are many examples on the php manual site, but be careful, you cannot echo anything (no html ect) before the redirect in the file, or it will simply give you a blank screen and do nothing at all.

call a function on onchange and get the changed value..and change the bgcolor by using document.bgColor=col;

You should look into using POST or GET methods with PHP to get info on what was sent to the page ("red", "green", or "blue") and then use sessions to save this data until viewer leaves the page.

Forms in HTML are designed to be used as follows: A form has a bunch of inputs, each with a name and a value (which the user sets), and a submit button which redirects the page to where ever is specified, and the data in all of the inputs is sent as well. PHP is a good language to retrieve this data and make use of it.

I suggest looking up a few tutorials with data retrieval like this. I'm too slack to find you any links so google away.

thanks humbug,

i hope you can explain to me further how to use session.

THANK YOU!!!

No problem. Munaz's following idea is a very good one for what your trying to do:

call a function on onchange and get the changed value..and change the bgcolor by using document.bgColor=col;

If you want to go down the path of having the users selection "saved" you only need cookies (I was wrong to suggest sessions). Look them up on the net, there are plenty of tutorials out there.

Thanks to all who responded to this thread....


thank you very much....

:) :) :)

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.