...

View Full Version : FAcing difficulty in retreiving a selected option value.



shashishinde
12-15-2009, 02:29 PM
Hi,
I am using following code--


<td>
<centre>
<select id=\"extenddays\" size=\"1\" name=\"extenddays\">
<option value\=\"2\"> 2 </option>
<option value\=\"4\"> 4 </option>
<option value\=\"7\"> 7 </option>
</select>
<a href=?ext_days=\"extendform.extenddays.value\" & ?extfid=" . $data->{'fid'} ." \" >
<INPUT TYPE=\"SUBMIT\" NAME=\"extend\" VALUE=\"extend\" />
</a>
</centre>
</td>


Here, I want that when I click on 'extend' button, it should redirect to the url given in the href.. But while forming url run time , it is not retrieving the value of "extenddays" ( which is selected option value)..

Please help.

Cheers,
Shashikant Shinde

gusblake
12-15-2009, 02:38 PM
You can't insert bits of javascript inline like that. That value is literally 'extendform.extenddays.value', not 'whatever the value is'.

You have to change it later, like



link.href="?ext_days="+extendform.extenddays.value;

Kor
12-15-2009, 03:30 PM
For the beginning: What's the use of those backslashes? \


<td>
<centre>
<select id=\"extenddays\" size=\"1\" name=\"extenddays\">
...

gusblake
12-15-2009, 03:36 PM
The OP doesn't make it clear, but I gather it's within a PHP echo.

Kor
12-15-2009, 03:46 PM
shashishinde, post the HTML generated code, not the PHP nor ASP nor whiechever server-side language code. JavaScript interacts only with the HTML elements. We need to see them.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum