How to use the textbox value to fetch the records and to display it in the same page

Posted by Aruna on Stack Overflow See other posts from Stack Overflow or by Aruna
Published on 2010-03-04T05:31:49Z Indexed on 2010/04/04 9:23 UTC
Read the original article Hit count: 199

Filed under:

Hi,

  i am having a Form like


  <script language="javascript" type="text/javascript">

     function formfn()
  {
   var str = document.getElementById('TitleSearch').value;
  alert(str);//displays the keyword like database
   }

   </script>






  <form name="f1" method="post">
   <p><label for="TitleSearch">Keywords:</label> 
   <input title="Keyword" size="40" value="" id="TitleSearch"></p> 
   <p>
   <input type="submit" id="im-search" value="Search" name="im-search" onClick="formfn();"></p>
      </form>

I am having a page where in the top i have this form on search it has to take the value of the textbox TitleSearch and to use this to retrieve the records matching by

      <?php
$db         =& JFactory::getDBO();
    $query =  'SELECT * from #__chronoforms_Publications where keyword like "%valueretrieved%" ';
    $db->setQuery($query);
    $rows = $db->loadObjectList();
      //echo $rows;
      ?>

Once the search button is clicked the text box value of the keyword is retrieved . I am trying to use this value in the select query to fetch the records and to display in the same page..

How to do so..

© Stack Overflow or respective owner

Related posts about JavaScript