-1

I have select option box and also add many field i want to update through submit button.

Here is code:

<td><select name="select_provider" id="select_provider">

     <option value="selected">All</option>
     <?php $sql_list_provider=mysql_query("Select opp_provider from  ambition_opp_provider");
     while($cmd=mysql_fetch_array($sql_list_provider)){
     ?>
   <option><?php echo $cmd['opp_provider'];}?></option>

    </select></td>
        <td><input type="submit" name="update_provider" id="update_provider" value="UPDATE PROVIDER" style="background-color:#000000; color:#fff"/></td>

Thanks for advance.

1 Answers1

0

In your code </option> is outside the loop that causes to generate invalid html. Simply remove } from and add <?php } ?> after </option>

And add value attribute to option tag. value="<?php echo $cmd['opp_provider'];?>" and in server-side, you'll be able to access it like: $_POST['select_provider'] (assume you use post method).

Leri
  • 12,367
  • 7
  • 43
  • 60
  • This code is inside loop i am sending on select box and update button.. i want to which value are selected i can change through submit button.. – user1625518 Sep 03 '12 at 13:44