PHP drop down coding question -


Can someone show me how to make a statement where the default value of 0 below a drop (my case ) Automatically submit form if possible?

  session_start (); $ Current = release ($ _ session ['client namefor'])? $ _SESSION ['client namefor']: 0; While ($ line = mysql_fetch_array ($ result)) {$ id = $ row ["Client_Code"]; $ Cheese = $ line ["Client_Full_Name"]; $ Value = "$ id, $ thing"; ? $ Sel = ($ id == $ current) selected ':' '; $ Options4 = "& Lt; OPTION $ sel VALUE = \" $ value \ "& gt; $ cheese & lt; / option & gt;"; }? & Gt; & Lt; Form name = "form" action = "& lt ;? php echo $ _SERVER ['PHP_SELF'] ;? & gt;" Method = "post" & gt; & Lt; SELECT NAME = "ClientNameFour" OnChange = "this.form.submit ()") & gt; Option Price = 0> Customer & lt ;? Php $ options4? & Gt; & lt; / SELECT & gt; & lt; / FORM>;    

onchange event and some javascript Generally, your generated HTML should look something like this:

  form id = "form" name = "form" method = "POST" action = "http : //example/script.php "& gt; select id =" select "name =" select "onChange =" document.getElementById ('form'). Submit (); "& Gt; Option value =" 0 "selected =" selected "> 0  <

Compared to your solution:

onchange event is only removed when you select an unselected option, no additional check is needed.

  • id is missing in your
    gt; ta
  • you Need to close the tag
  • you probably go Askript change in the onchange & lt; select & gt; tag
Specialty

Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -