Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

simple search form

$
0
0
Hello everyone thank you in advance for any help ;)

In view/index.php main page file I have to add simple form:
<?php echo CHtml::beginForm();

echo CHtml::textField('text_to_find_ID', ''); 
echo CHtml::submitButton('FIND'); 

echo CHtml::endForm(); ?>


TextField will be full in always the same way - for example: "ID15:other useless incoming data"

What I have to do after press FIND by user is:
1. read text field...
2. use preg_split to get ID (and trim ID letters of course)
$look_for_id = preg_split('/:/','text_to_find_ID');
$found_id = $look_for_id[0];

3. jump user to MyModelName/view/found_id

Can anyone help me to build it properly? Please :)

Viewing all articles
Browse latest Browse all 18717

Trending Articles