kenjisoul
(Xuyuan8)
December 6, 2013, 7:47am
1
I want to pass input from test.php show in ttt.php, how to do?
test.php
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'test',
'type'=>'horizontal',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<div class="form">
<?php echo CHtml::beginForm(); ?>
<?php echo CHtml::errorSummary($model); ?>
<div class="row">
<?php echo CHtml::Label('Q_number',''); ?>
<?php echo CHtml::TextField('Name','', array('id' => 'Name'));?>
</div>
<div class="row submit">
<?php echo CHtml::submitButton('Login',array('name' => 'Login')); ?>
</div>
<?php echo CHtml::endForm(); ?>
<?php $this->endWidget(); ?>
</div><!-- form -->
ttt.php
<?php
echo "hi".'<br>';
echo $_POST['text'];
controller
public function actionttt(){
$this->render('ttt');
}
public function actionTest(){
$model = new Customers();
if(isset($_POST['Login']))
$this->redirect(array('customers/ttt'));
$this->render('test',array('model'=>$model));
}
Balu
(Mbalu123)
December 6, 2013, 9:00am
2
kenjisoul:
I want to pass input from test.php show in ttt.php, how to do?
test.php
<?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm', array(
'id'=>'test',
'type'=>'horizontal',
'enableClientValidation'=>true,
'clientOptions'=>array(
'validateOnSubmit'=>true,
),
)); ?>
<div class="form">
<?php echo CHtml::beginForm(); ?>
<?php echo CHtml::errorSummary($model); ?>
<div class="row">
<?php echo CHtml::Label('Q_number',''); ?>
<?php echo CHtml::TextField('Name','', array('id' => 'Name'));?>
</div>
<div class="row submit">
<?php echo CHtml::submitButton('Login',array('name' => 'Login')); ?>
</div>
<?php echo CHtml::endForm(); ?>
<?php $this->endWidget(); ?>
</div><!-- form -->
ttt.php
<?php
echo "hi".'<br>';
echo $_POST['text'];
controller
public function actionttt(){
$this->render('ttt');
}
public function actionTest(){
$model = new Customers();
if(isset($_POST['Login']))
$this->redirect(array('customers/ttt'));
$this->render('test',array('model'=>$model));
}
change the action like this…
public function actionTest(){
$model = new Customers();
if(isset($_POST['Login']))
$this->redirect(array('customers/ttt',array('text'=>$_POST['text'])));
$this->render('test',array('model'=>$model));
}
ttt.php
<?php
echo "hi".'<br>';
echo $_REQUEST['text'];
kenjisoul
(Xuyuan8)
December 6, 2013, 9:24am
3
Balu:
change the action like this…
public function actionTest(){
$model = new Customers();
if(isset($_POST['Login']))
$this->redirect(array('customers/ttt',array('text'=>$_POST['text'])));
$this->render('test',array('model'=>$model));
}
ttt.php
<?php
echo "hi".'<br>';
echo $_REQUEST['text'];
error Undefined index: text
Balu
(Mbalu123)
December 6, 2013, 9:47am
4
$_POST[‘text’] – Means you text box name
Here you textbox name is "Name", so replace text to "Name"…
kenjisoul
(Xuyuan8)
December 6, 2013, 1:59pm
5
erroe
Undefined index: text
C:\xampp\htdocs\test\protected\views\customers\ttt.php(3)
1 <?php
2 echo "hi".'<br>';
3 echo $_REQUEST['text'];
ahmed201
(Rifajas)
December 8, 2013, 1:06pm
6
you can check the values whether it is set or not by using
echo '<pre>';
print_r($_REQUEST);
echo '</pre>';