Yii Framework Forum: simple search form - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

simple search form with preg_split usage Rate Topic: -----

#1 User is offline   RivenTel 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 05-July 11

Posted 01 August 2011 - 06:17 AM

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 :)
0

#2 User is offline   hoAAah 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 28-May 12

Posted 17 July 2013 - 10:36 AM

Make a new action for search function...
	public function actionSearchid($look){
//your code goes here
}

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users