0){ $free_id=$set_main['id']; break; } } if($free_id !=""){ $_SESSION['dealer_id'] = $row['user_id']; $_SESSION['name'] = $row['name']; $_SESSION['city'] = $row['city']; $action = 'edit_order.php?order_id='.$free_id; $arr = array('status'=>'success', 'url'=>$action); echo json_encode($arr); exit; }else{ $action="shopping_cart_ef.php"; $_SESSION['dealer_id'] = $row['user_id']; $_SESSION['name'] = $row['name']; $_SESSION['city'] = $row['city']; $arr = array('status'=>'success', 'url'=>$action); echo json_encode($arr); exit; } } } else { echo "Something went wrong. Please try again"; exit; } } ?>