Greeting to all , i want to use a jquery ajax plugin: "
auto populating select boxes" for a submit form of the mxdirectory modules.
i have upload the sql file and test it on the server out of xoops, it works correctly!
then i try to make this works on xoops,
1. i have place those html code to the modules html file,
2. upload the sql file that the plugin provided to xoops modules prefix.
3. in the templates theme.html, i have include the jquery.js and the select-chain.js file in the header
4.the select-chain.php file i have place it to root, theme templates, modules root , modules templates directory..
(because i don't know the script "url:select-chain.php" means where)
i have edited the php file but not working...
here r the orignal php code, like this:
Quote:
if (@$_REQUEST['ajax']) {
// connect to local database 'test' on localhost
$link = mysql_connect('localhost', 'root', '');
if ($link == false) trigger_error('Connect failed - ' . mysql_error(), E_USER_ERROR);
$connected = mysql_select_db('test', $link); if ($connected) { $results = mysql_query('select * from test.select_chain where category="' . strtolower(mysql_real_escape_string(strip_tags($_REQUEST['category']))) . '"');
$json = array(); while (is_resource($results) && $row = mysql_fetch_object($results)) {
$json[] = '"' . $row->label . '"'; }
echo '[' . implode(',', $json) . ']'; die(); // filthy exit, but does fine for our example. }
else
{ user_error("Failed to select the database"); } }
?>
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Select Chain
Select Chain
Element Category
Element
Attributes
and i have edited the php file to this:
Quote:
if (@$_REQUEST['ajax']) {
global $xoopsDB;
$results=$xoopsDB->query('select * from x620_xdir_select_chain where category="' . strtolower(mysql_real_escape_string(strip_tags($_REQUEST['category']))) . '"');
$json = array(); while (is_resource($results) && $row = $xoopsDB->fetch_object($results)) {
$json[] = '"' . $row->label . '"'; } echo '[' . implode(',', $json) . ']'; die();
}
?>
i have copy a part of html code to modules index.html file..
Quote:
i have include the jquery script and the plugin script on the header of the theme.html, like this:
Quote:
i have place this php file in the root , theme, modules, modules theme directory....
coz i don't know the script file " url: " means where.....
by the way i don't know how to correct those php code to connect the xoops database correctly..
in fect i m not a coder...haha
sorry for my poor english..
and thx for helping!