Hi i am a Yii newbie and got this simple submit form
<form action="chunkify.php" method="POST">
Enter a word: <input type="text" name="word" /><br />
How long should the chunks be? <input type="text" name="number" /><br />
<input type="submit" value="Chunkify!">
</form>
and chunkify.php
<?php
$word = $_POST[‘word’];
$number = $_POST[‘number’];
$chunks = ceil(strlen($word)/$number);
echo “The $number-letter chunks of ‘$word’ are:<br />\n”;
for ($i=0; $i < $chunks; $i++) {
$chunk = substr($word, $i*3, 3);
printf("%d: %s<br />\n", $i+1, $chunk);
}
?>
It works but i tried to separate this code into Yii MVC and it does not work.
I used Yii 's controller generator and it generates a controller and a view
In the view , i create the submit form
<form action="chunkify.php" method="POST">
Enter a word: <input type="text" name="word" /><br />
How long should the chunks be? <input type="text" name="number" /><br />
<input type="submit" value="Chunkify!">
</form>
In the controller
public function actionCut()
{
$word = $_POST['word'] // this line does not work
$this->render('cut');
}
I can not get the value with _POST. Thank you for your help.