Translate

Thursday 18 September 2014

Updation status in Select box the Selected Value Echoed

Explaination:

            In the above code have to update the value in select box.the selected value in the 
            option value in database is to echoed in the select box.In this i have used PHP for 
            to echoed the values.I hope this will very usefull for Developers as well as Begineers.

Form:
         
<td >
<select name="shipping" onchange="showUpdate(this.value,'<?php echo $row['booking_number']; ?>')" style="width: 100px;" id="txtHint3" >
<option  <?php if ($row['shipping_status'] == "----" ) echo 'selected'; ?> value="----">----</option>
<option  <?php if ($row['shipping_status'] == "Delivery In Progress" ) echo 'selected'; ?> value="Delivery In Progress">Delivery In Progress</option>
<option <?php if ($row['shipping_status'] == "Delivered" ) echo 'selected'; ?> value="Delivered">Delivered</option>
</select>
</td>




PHP Coding For Update:

<?php
include("db.php");
$id2=$_GET['id'];//Id is pass through ajax
$shipping=$_GET['status'];//Status is pass through ajax
mysql_query("update tbl_name set shipping_status='$shipping' where booking_number='$id2'");

echo "Status updated Successfully";
?>

No comments:

Post a Comment