php - update database field on submit -
when admin ticks row or more in table , clicks on approve button, row data (request_id primary key) should updated in database field is_approved , should change 'pending' 'approved' is_approved field has 2 enum: pending , approved. how can this?
<form action = "admin.php" method = "post"> <input type="button" name="accept" value="accept" /> <input type="hidden" name="submitted" value="true" /> </form>
php code:
if(!empty($_post['accept'])) { $request_id = $_post['request_id']; foreach($request_id $is_approved) { $query = mysql_query("update request set is_approved = 'approved' is_approved =$request_id"); } }
change form as:
<form action = "admin.php" method = "post"> <input type="button" name="accept" value="accept" /> <input type="text" name="request_id[]" value=1/> <input type="text" name="request_id[]" value=2/> <input type="hidden" name="submitted" value="true" /> </form>
the value should actual request_id
Comments
Post a Comment