Page 1 of 1

How to redirect to link with <select option in php?

Posted: Tue Feb 03, 2009 8:30 am
by susain
Hi Friends,

My requirement is redirect to a page based on select option

I have a html code as shown below
<select name="url">
<option Value=".....&pid=00ac92ca52dc2ad07c3d5">10</option>
<option Value=".....&pid=00ac92ca52dc2ad07c3d6">20</option>
</select>

Problem is in the php page &pid is treating as variable, to redirect to page I must need &pid=.....

How solve this problem?

Thanks,
Farooq

Re: How to redirect to link with <select option in php?

Posted: Tue Feb 03, 2009 10:25 am
by mavieng

Code: Select all

 
<script type='text/javascript'>
    function openurl()
    {
        site = document.myform.url[document.myform.url.selectedIndex].value;
        if(site!="")
        {
            location.href = site;
        }
    }
</script>
 
<form name='myform'>
<select name="url" onchange='openurl()'>
<option Value="">Select One</option>
<option Value="http://www.rediff.com">Rediff.com</option>
<option Value="http://www.whereincity.com">Whereincity.com</option>
</select>
</form>