Edit a bargain API
<?php
include("src/Ratebe.php");
include("config.php");
$action = 'bargain_edit';
$msg = 'You can update this bargain';
$deleted = false;
$id = @$_REQUEST["id"];
if(@$_POST["submit"]=="Update"){
$id = $_POST['id'];
$title = $_POST['title'];
$url = $_POST['url'];
$photo_url = $_POST['photo_url'];
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
$des = $_POST['des'];
$catID = $_POST['catID'];
$tags = $_POST['tags'];
if($title=="" || $url=="" || $photo_url=="" || $start_date=="" || $end_date=="" || $des=="" || $catID==""){
$msg = 'You need to enter all required info for * field';
}
else{
$rest_data = array(
'bargainID' => $id,
'bizID' => $auth_arr['bizID'],
'title' => $title,
'url'=> $url,
'photo_url'=> $photo_url,
'start_date'=> $start_date,
'end_date'=> $end_date,
'des'=> $des,
'catID'=> $catID,
'tags'=> $tags
);
$Ratebe = new Ratebe($auth_arr,$action,$rest_data);
$result_arr = $Ratebe->go();
$go = true;
if($result_arr["result"]=="success")
$msg = 'You have updated the bargain successfully';
else if($result_arr["result"]=="fail")
$msg = 'You have failed to update the bargain. Reason: '.$result_arr["error"];
}
}
?>
Scroll