XML : search filter from xml in php

I filtered whole title from my XML.

  if(isset($_POST["submit"]))          {            $state=$_POST["state"];            $title=$_POST["title"];              $result = simplexml_load_file('sample.xml');          $record = $result-> xpath('(/jobs/job[positiontitle="'.$title.'"])|(/jobs/job[state="'.$state.'"])');             foreach ($record as $row):  $jobid=$row->jobid;    ?>          <li class="result">           <a href="<?php print base_path(); ?>job/?<?php print $jobid;?>">          <h3 class="title"><?php $title=$row->positiontitle;           echo $title; ?></h3>            </li>   <?php              endforeach;  ?>    

Here my xml

  <jobs>  <job>  <jobid>  <![CDATA[ 02304485 ]]>  </jobid>  <positiontitle>  <![CDATA[ Maintenance Manager ]]>  </positiontitle>  </job>  </jobs>    

If I type the title "maintenance",the title should be filtered.In sql we can filter by using like operation. Here what should do?

No comments:

Post a Comment