Hi,
in my form i am using table , and in that table i have used update & delete operation.
when i am deleteing particular record from that table, it will thows an error "Method Not Allowed (#405)"
Method Not Allowed. This url can only handle the following request methods: POST.
my code is given below:
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\grid\GridView;
use yii\data\ActiveDataProvider;
use app\modules\fees\models\FeesPaymentTransaction;
use yii\web\Controller;
use app\modules\student\models\StudentTransaction;
/* @var $this yii\web\View */
/* @var $model app\modules\fees\models\FeesPaymentTransaction */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="operation">
<?php //if(!Yii::app()->user->getState('stud_id') && !Yii::app()->user->getState('emp_id')) { ?>
<?php echo Html::a('<i class="fa fa-money"></i>Cash',['payfeescash','id'=>$_REQUEST['id']],['id'=>'testing','class'=>'btn btn-success']); ?>
<?php echo Html::a('<i class="fa fa-credit-card"></i>Cheque / DD',['payfeescheque','id'=>$_REQUEST['id']],['id'=>'testing','class'=>'btn btn-info']); ?>
<?php echo Html::a('<i class="fa fa-chevron-left"></i>Back','addFees', ['class'=>'btn btn-warning']); ?>
<?php //} ?>
</div>
<div class="portlet box blue">
<div class="portlet-title">
<i class="fa fa-inr"></i><span class="box-title">Fees Details</span>
</div>
<?php
$sql = 'SELECT * FROM fees_payment_transaction where fees_payment_student_id ='.$_REQUEST['id'];
$paidFees = FeesPaymentTransaction::findBySql($sql)->all();
//print_r($paidFees); exit;
$query= new \yii\db\Query();
$query -> select(['batch_fees'])
-> from('batch as b')
-> join('join',
'course as c',
'b.course_id=c.course_id')
->where('b.batch_id='.StudentTransaction::findOne($_REQUEST['id'])->student_transaction_batch_id);
$command=$query->createCommand();
$fees=$command->queryAll();
?>
<div class="grid-view">
<table class="items" style="float:left;width:100%;border-collapse: collapse;">
<tr class="table_header" style="align:center;">
<th>SI.NO.</th>
<th>Date</th>
<th>Payment Method</th>
<th>Paid Amount</th>
<th>Cheque/DD Number</th>
<th>Receipt Number</th>
</tr>
<?php
if(!empty($paidFees)) {
$i=1;
foreach($paidFees as $details)
{
echo '<tr align="center">';
echo '<td>'.$i.'</td>';
echo '<td>'.$details['fees_payment_received_date'].'</td>';
echo '<td>'.$details['fees_payment_type'].'</td>';
echo '<td>'.$details['fees_payment_amount'].'</td>';
echo '<td>'.$details['fees_payment_cheque_number'].'</td>';
echo '<td>'.$details['fees_payment_receipt_no'].'</td>';
//if(Yii::checkAccess('Fees.FeesPaymentTransaction.Updatefeescash') && Yii::checkAccess('Fees.FeesPaymentTransaction.Updatefeescheque'))
//{
echo '<td>';
if($details['fees_payment_type']=='Cash'){
echo Html::a(Html::img(Yii::$app->homeUrl."images/update.png" ,['Edit']),['upadatefeescash', 'id'=>$_REQUEST['id'],'fees_id'=>$details['fees_payment_transaction_id']]);
}
else
{
echo Html::a(Html::img(Yii::$app->homeUrl."images/update.png" ,['Edit']),['updatefeescheque', 'id'=>$_REQUEST['id'],'fees_id'=>$details['fees_payment_transaction_id']]);
}
echo Html::a(Html::img(Yii::$app->homeUrl."images/delete.png" ,['Delete']), ['delete','fees_id'=>$details['fees_payment_transaction_id'],'id'=>$_REQUEST['id']],['confirm'=> Yii::t('app', 'Are you sure you want to delete this record?'),'method'=>'post']);
echo '</td>';
//}
echo '</tr>';
$i++;
}
}
echo '</table>';
?>
can you please suggest proper solution…
Thanks.