Reply
Search engine with multiple fields (ajax)
Old 04-27-2006, 07:34 AM Search engine with multiple fields (ajax)
Junior Talker

Posts: 1
hi fellas,

i want to add another <input> field and include this field on this ajax search engine...this is possible?. Im using the sajax framework as you can see.

Sajax: http://www.modernmethod.com/sajax/download.phtml

here is code:

Code:
<?php
require("Sajax.php");
require("class.php4.inputfilter.php");
require("class_sql.php");


function select_model($SQLWhere){

global $db;

        $myFilter = new InputFilter(array(), array(), 0, 0);    // removes xss nastiness
        $no_tags = $myFilter->process($SQLWhere);               // from input strings
//$no_tags2 = ????

$var_count = $db->get_var("SELECT COUNT(*) FROM users WHERE name ILIKE '%". $no_tags . "%'" AND emailp ILIKE '%".$no_tags2."%'");

$users = $db->get_results("SELECT * FROM users WHERE name ILIKE '%". $no_tags . "%'" AND emailp ILIKE '%".$no_tags2."%'");

if ($var_count >= 1){

$out = "search on: '". $no_tags . "' returns:\n";


foreach ( $users as $user ){
$name = $user->name;

$out .=  $name .  "\n";

}
}
return $out;

}

//   
    sajax_init();
  // $sajax_debug_mode = 1;
    sajax_export("select_model");
    sajax_handle_client_request();

// The rest is lifted almost directly from the multiplication example
// on the sajax site.  I used a textarea instead of a text for th return value, and a
// onKeyUp to trigger the function.


?>

<html>
<head>
    <title>teste</title>
    <style>
    TEXTAREA {border-width:0;}
    </style>
    <script>
    <?php
    sajax_show_javascript();
    ?>
   
    function do_model_cb(z) {
        document.getElementById("z").innerHTML = z;
    }
   
    function do_model() {
        // get the folder name
        var x;
        x = document.getElementById("x").value;
        x_select_model(x, do_model_cb);
    }
    </script>
   
</head>
<body>
name:
  <input type="text" name="x" id="x" value="" size="15" onKeyUp="do_model(); return false;">
  <br><br>
<div name="z"  id="z"></div> 
</body>
</html>

thx for all help
eduacsp is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Reply     « Reply to Search engine with multiple fields (ajax)
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.10268 seconds with 13 queries