transfer to a new page through a select event

Reply

Join Date: Apr 2007
Posts: 46
Reputation: jk_bscomp has a little shameless behaviour in the past 
Solved Threads: 1
jk_bscomp jk_bscomp is offline Offline
Light Poster

transfer to a new page through a select event

 
0
  #1
Oct 28th, 2008
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...
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 93
Reputation: humbug is an unknown quantity at this point 
Solved Threads: 13
humbug's Avatar
humbug humbug is offline Offline
Junior Poster in Training

Re: transfer to a new page through a select event

 
0
  #2
Oct 28th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 78
Reputation: rickya100 is an unknown quantity at this point 
Solved Threads: 1
rickya100 rickya100 is offline Offline
Junior Poster in Training

Re: transfer to a new page through a select event

 
0
  #3
Oct 28th, 2008
Hi jk,

Like Humbug said it requires code on the persons local machine to do it.

There seems to be plenty of stuff out there to either use or experiment with.

Try this. Seems to do what you want.

http://www.web-source.net/javascript_redirect_box.htm
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 61
Reputation: Manuz is an unknown quantity at this point 
Solved Threads: 8
Manuz's Avatar
Manuz Manuz is offline Offline
Junior Poster in Training

Re: transfer to a new page through a select event

 
0
  #4
Oct 28th, 2008
  1. 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
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 46
Reputation: jk_bscomp has a little shameless behaviour in the past 
Solved Threads: 1
jk_bscomp jk_bscomp is offline Offline
Light Poster

Re: transfer to a new page through a select event

 
0
  #5
Oct 28th, 2008
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!!!
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 93
Reputation: humbug is an unknown quantity at this point 
Solved Threads: 13
humbug's Avatar
humbug humbug is offline Offline
Junior Poster in Training

Re: transfer to a new page through a select event

 
0
  #6
Oct 28th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 4
Reputation: financeSEObegin is an unknown quantity at this point 
Solved Threads: 0
financeSEObegin financeSEObegin is offline Offline
Newbie Poster

Re: transfer to a new page through a select event

 
0
  #7
Oct 28th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 61
Reputation: Manuz is an unknown quantity at this point 
Solved Threads: 8
Manuz's Avatar
Manuz Manuz is offline Offline
Junior Poster in Training

Re: transfer to a new page through a select event

 
0
  #8
Oct 29th, 2008
  1. call a function on onchange and get the changed value..and change the bgcolor by using document.bgColor=col;
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 46
Reputation: jk_bscomp has a little shameless behaviour in the past 
Solved Threads: 1
jk_bscomp jk_bscomp is offline Offline
Light Poster

Re: transfer to a new page through a select event

 
0
  #9
Oct 29th, 2008
Originally Posted by humbug View Post
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!!!
Reply With Quote Quick reply to this message  
Join Date: Oct 2005
Posts: 93
Reputation: humbug is an unknown quantity at this point 
Solved Threads: 13
humbug's Avatar
humbug humbug is offline Offline
Junior Poster in Training

Re: transfer to a new page through a select event

 
0
  #10
Oct 29th, 2008
No problem. Munaz's following idea is a very good one for what your trying to do:
Originally Posted by Manuz View Post
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.
Last edited by humbug; Oct 29th, 2008 at 10:33 am. Reason: Code tags make it ugly
"If your not having fun, your doing something wrong." - Humbug
★ Did I help you out? Did I piss you off? Add to my reputation!
The Gabriel Method is a great book for losing weight and keeping healthy - I know Jon Gabriel Personally.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC