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
|