Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. <?php
  2. class SiteController extends Controller
  3. {
  4. public function actionsearch()
  5. {
  6. $user_id = trim($_GET['id']);
  7. $model = new Job ;
  8. if(isset($_POST['Job']))
  9. {
  10. if(Yii::app()->getRequest()->getIsAjaxRequest())
  11. {
  12. echo CActiveForm::validate(array($jobProfileM2));
  13. Yii::app()->end();
  14. }
  15. $model->attributes=$_POST['Job'];
  16. if($model->validate())
  17. {
  18. $title=$_POST['Job']['title'];
  19. $experience=$_POST['Job']['experience'];
  20. echo "data".$experience=trim($experience);
  21. if($_POST['Job']['experience'] == " ")
  22. {
  23. echo "hai";
  24. }
  25. $model=Job::model()->findAll(array('select'=>'*',"condition"=>"(title like '%$title%')
  26. or (key_skills like '%$title%')",));
  27. $number=count($model);
  28. //$this->redirect($this->createUrl('site/search_result',array('title'=>$title,)));
  29. }
  30. else
  31. {
  32. Yii::app()->user->setFlash('error', "Validation failed!");
  33. }
  34. }
  35. $this->render('search',array('model' =>$model));
  36. }
  37. }
  38. ?>
  39.  
  40. <div class="form">
  41. <?php $form=$this->beginWidget('CActiveForm', array(
  42. 'id'=>'login-form',
  43. 'enableClientValidation'=>false,
  44. 'htmlOptions' => array(),
  45. 'clientOptions'=>array(
  46. 'validateOnSubmit'=>true
  47. ),
  48. )); ?>
  49. <?php
  50. foreach(Yii::app()->user->getFlashes() as $key => $message) {
  51. echo '<div class="flash-' . $key . '">' . $message . "</div>n";
  52. }
  53. ?>
  54. <div class="row">
  55. <?php echo $form->labelEx($model,'Keyword'); ?>
  56.  
  57. <?php echo $form->textField($model,'title'); ?>
  58. <?php echo $form->error($model,'Keyword'); ?>
  59. </div>
  60. <div class="row">
  61. <?php echo $form->labelEx($model,'Experience'); ?>
  62. <?php echo $form->textField($model,'experience'); ?>
  63. <?php echo $form->error($model,'experience'); ?>
  64. </div>
  65. <div class="row buttons">
  66. <?php echo CHtml::submitButton('Search'); ?>
  67. </div>
  68. <?php $this->endWidget(); ?>
  69. </div>
  70.  
  71. if($_POST['Job']['experience'] == " ")
  72. {
  73. echo "hai";
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement