i have one dropdown box in while loop. when i am select one option for one row without submit it can only change. how to do?

actually i am retriving data from database. here status dropown is here. then i selected status on dropdown for particular content. so it con change the status of particular content with out submit.

can we see the code please?.. explain more please..

u can send the select box parameters through url like this

<select name="order" id="order" onChange="changeval(this.value)">
				    $sel_merch="select * from table";
				  ?><option value="<? echo $i;?>_<? echo $fetch['m_id_pk'];?>"><? echo $i;?></option><? $i++; }?>

and javascript function is

function changeval(id){

you mean want to change your dropdown without without refreshing the page? then use AJAX

oh, i got you.. hope this helps

 $db_connection = mysql_connect("localhost","youser","busword");

 <script src="help.js" type="text/javascript"></script>
      <select name="order" id="order">
      $sel_merch="select * from testtbale";

     while( $results=mysql_fetch_array($merch_res)){
	echo  "<option value=\"".$results['m_id_pk']."\">";
	echo  $results['m_id_pk']."</option>";

javascript file:

 function start(){
	 var theVal = this.value;

did it help?

Member Avatar

The js window.location solution will have the effect of redirecting/submitting - well loading a full page - whatever you wanna call it. Because this is a straightforward shot to a url.

You're better off with an ajax solution. Have a look at jQuery or prototype implementations of dropdown content changers. This is a very basic use of ajax - you shouldn't have much trouble using it.

At most you'll need the following:

1) the main page with the dropdown
2) ref to a js library in the head area
3) either an external js file for your ajax functions or inline script in the head area.
4) an external php file to handle ajax calls (receive data, process and return data).

Caveat: Ajax is well-known for poor accessibility issues. Sending data through a dropdown as opposed to using a proper submit button may cause problems. I'm no accessibility guru, so couldn't really say for certain.