WHat I have been trying to do is pass the data from the selected radio button in my view, to the php in the controller. I then add the existing token balance to the selected amount and submit that back into the database.
Problem is I can't get the values from the html radio button to the php controller/action. I am using the latest version of php and YII framework.
The view
$this->breadcrumbs = array(
'Tokens' => array('index'),
$model->TokenID =>
'buy',
);
?>
<h1>Buy Tokens
</h1>
<?php
echo 'Your balance is ' .$model->TokenAmount;
?>
<FORM name ="form1" method ="post" action = "">
<Input type = 'Radio' Name ='10tokens' value= '10'
>10
<Input type = 'Radio' Name ='25tokens' value= '25'
>25
<Input type = "Submit" Name = "Submit1" VALUE = "Purchase Tokens">
</FORM>
and the action in the controller
public function actionBuy() {
$_id = Yii::app()->user->getId();
$model = Tokens::model()->findByAttributes(array('UserID' => $_id));
if ($model === null)
throw new CHttpException(404, "Keep calm! If you havent bought tokens before this is normal");
$this->render('buy', array(
'model' => $model,));
// $qty = $_POST['form1'];
// $newtkamount = ($_model->TokenAmount + $qty);
// echo $qty . $newtkamount . $_model->TokenAmount;
}