vinpkl Posted June 22, 2009 Share Posted June 22, 2009 hi all i have multiple checkboxes which holds value of "order_id" in my form based on arrays. The code i m using works fine and deletes the order based on selected checkbox. When order gets deleted then it shows message "Order deleted". But the problem i m facing is that if the order doesnt gets deleted then also it shows message "Order deleted". Means everytime it shows same message "Order deleted successfully" whether order gets deleted or not. if(isset($_REQUEST['submit'])) { $selcheckbox=array(); $selcheckbox=$_REQUEST['item']; $count=count($selcheckbox); for($i=0;$i<$count-1;$i++) { $del_id = $selcheckbox[$i]; $qry2 = "delete FROM new_order WHERE order_id=$del_id and payment_status='PENDING'"; $result2 = mysql_query($qry2); if(mysql_query($qry2)) { $msg="order ( ".$del_id." ) Deleted Successfully"; } else { $msg="Error Deleting order"; } } } This is html echo "<td valign=top>". "<input type='checkbox' name='item[]' id='item[]' value=". $row['order_id']. ">"."</td>"; vineet Link to comment https://forums.phpfreaks.com/topic/163207-solved-array-deletion-showing-same-mesage-every-time/ Share on other sites More sharing options...
joel24 Posted June 22, 2009 Share Posted June 22, 2009 change if(isset($_REQUEST['submit'])) to if(isset($_POST['item'])) then the code will only execute if any checkboxes are checked. also change the $_REQUEST's to $_POST.... Link to comment https://forums.phpfreaks.com/topic/163207-solved-array-deletion-showing-same-mesage-every-time/#findComment-861150 Share on other sites More sharing options...
vinpkl Posted June 22, 2009 Author Share Posted June 22, 2009 change if(isset($_REQUEST['submit'])) to if(isset($_POST['item'])) then the code will only execute if any checkboxes are checked. also change the $_REQUEST's to $_POST.... hi joel24 thanks for the reply. works fine. vineet Link to comment https://forums.phpfreaks.com/topic/163207-solved-array-deletion-showing-same-mesage-every-time/#findComment-861157 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.