Send value with Onchange and javascript function -


i'm new @ javascript , need submit form when select dropdown list. here sample code :

<form action="" method="post">   <select name="car" onchange="this.form.submit()">     <option value="car1">car1</option>     <option value="car1">car1</option>     <option value="car1">car1</option>   </select>   <!-- other code -->   <input type="submit" name="sentvalue"> </form> 

this form , when selects dropdown, form automatic submit need sentvalue when automatic submit form. can me capture sentvalue when select dropdown.

if want send other data form submit can send in hidden inputs

<input type='hidden' name='data1' value='test1' /> <input type='hidden' name='data2' value='test2' /> //etc 

and if want value of submit button form set value attribute code submit button every else seems fine,

<input type="submit" name="sentvalue" value="test1" /> 

hope answers question


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -