Explaination:
Update the Status in the DB as 0 or 1 and echoed the selected value in Select Box Using PHP. We have to Update the all fields in the tbl u have to use the array for updation.This is the
easy way and understand the coding for the status Updation. This tutorial is very usefull for the Developers and Beginners.
Note: <?php if($reserved_status['reserved_status'] == '0')
=>reserved_status-Field in table,
=>Fetching Variable-$reserved_status,
Form:
Update the Status in the DB as 0 or 1 and echoed the selected value in Select Box Using PHP. We have to Update the all fields in the tbl u have to use the array for updation.This is the
easy way and understand the coding for the status Updation. This tutorial is very usefull for the Developers and Beginners.
Note: <?php if($reserved_status['reserved_status'] == '0')
=>reserved_status-Field in table,
=>Fetching Variable-$reserved_status,
Form:
<select name="status[]"> <option value="0" <?php if($reserved_status['reserved_status'] == '0'){?>selected="selected"<?php }?>>Available to Public</option> <option value="1" <?php if($reserved_status['reserved_status'] == '1'){?>selected="selected"<?php }?>>Reserved or Blocked </option> </select>
Updation coding in PHP:
<?php if(isset($_POST['update'])) { for($i=0;$i<sizeof($_POST['section_id']);$i++) { $section_name=$_POST['section_name'][$i]; $status=$_POST['status'][$i]; $update=mysql_query("update tbl_name SET section_name='$section_name',reserved_status='$status' where section_id= '".$_POST[section_id][$i]."' "); } } ?>
No comments:
Post a Comment