Reputation: 3560
I have a problem when I post data from android to Yii2 action, I have actionAdd in controller Like this
public function actionAdd()
{
$model = new Orders();
if( isset($_POST['orders_id']) && isset($_POST['orders_uid']) && isset($_POST['orders_bid']) &&
isset($_POST['orders_sid']) && isset($_POST['orders_quantity']) && isset($_POST['orders_cost']) &&
isset($_POST['orders_discount']) && isset($_POST['orders_date']) && isset($_POST['orders_sync_status'])){
$model->orders_id = $_POST['orders_id'];
$model->orders_uid = $_POST['orders_uid'];
$model->orders_bid = $_POST['orders_bid'];
$model->orders_sid = $_POST['orders_sid'];
$model->orders_quantity = $_POST['orders_quantity'];
$model->orders_cost = $_POST['orders_cost'];
$model->orders_discount = $_POST['orders_discount'];
$model->orders_date = $_POST['orders_date'];
$model->orders_sync_status = $_POST['orders_sync_status'];
$model->save(false);
}
}
And in my android app I set this URL
HttpPost httppost = new HttpPost("http://192.168.101.147/yii/mobile_orders/backend/web/orders/add");
when I post I think its not go to action, Since I try to create simple php page on the server and Im get a POST data Truth, Also Im try to set actionAdd code in index.php under web yii2 root, and its work fine .. but when I try use action page, Im not get any data .. any help ^_^
thanks
Upvotes: 0
Views: 313
Reputation: 21
You can set action code under run application, this will be work (like index.php get a code and set it, its will work .. but Im sure this not a good solution)
Upvotes: 1