Hi Friends please tell me where I am wrong cause the database is still unchanged even though update query is executed successfully Thank you
here is the form code
echo'<form action="processor.php" method="post" id ="post_form">';
echo '<input type="hidden" name= "status" id="status" value="">';
$upload_arr=array("1");
foreach($upload_arr as $upload_id)
{
echo '<input type="button" name="accept-<?=$upload_id?>" value="accept" onclick="submit_this(this.name)"/><br>';
echo '<input type="button" name="reject-<?=$upload_id?>" value="reject" onclick="submit_this(this.name)"/><br>';
echo '<input type="button" name="saccept-<?=$upload_id?>" value="saccept" onclick="submit_this(this.name)"/><br>';
echo '<input type="button" name="sreject-<?=$upload_id?>" value="sreject" onclick="submit_this(this.name)"/><br>';
}
echo '</form>';
Note :here i have used $upload_id a php variable which has row[upload id] i.e. it is like accept 1,reject1,saccept1 ans sreject1 for first image and for second image it is accept2 reject2 and so on
Now the code for processor.php
$status_pass = isset($_POST['status'])?$_POST['status']:NULL;
if(!empty($status_pass)){
$status_arr = explode('-', $status_pass);
$action = $status_arr[0];
$upload_id = $status_arr[1];
if($action == 'accept'){
$status = 1;
}
if($action == 'reject'){
$status = 2;
}
if($action == 'saccept'){
$status = 3;
}
if($action == 'sreject'){
$status = 4;
}
echo $status;
$sql="UPDATE upload SET status='$status' where upload_id = '$upload_id' ";
echo "update success";
$result = mysql_query("$sql") or die("Invalid query: " . mysql_error());
}