Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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

Posts: 1
Trades: 0
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
 
 
Register now for full access!
Reply     « Reply to Search engine with multiple fields (ajax)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.51948 seconds with 12 queries