
Works in example but not in other script
Posted by:
logz05 (IP Logged)
Date: May 15, 2007 10:22AM
Hi Panos,
This is a very useful script - I have been looking for something like this for ages.
I have it working great in the example.php with my own database tables.
I am now trying to add the script into an existing form however I find that it fails. I have tried the following without success:
1. <?php include("example.php");?> both with and without <script src="prototype.js" type="text/javascript"></script> in the page. The files are in teh same directory as the file with the include.
2. Adding the following code in the file:
<?php
include("top_script.php");
include("sc_classes.php");
$sc_ajax_select_boxes = new sc_ajax_select_boxes();
$sc_ajax_select_boxes->add_select_box('town_lookup','town_id','state','town_id','','sel1','sel_id_1','');
$sc_ajax_select_boxes->add_select_box('town_lookup_sub','sub_type','municipality','sub_type','st21','sel2','sel_id_2','');
$sc_ajax_select_boxes->add_select_box('town_lookup_sub_sub','sub_type','town','sub_type','st22','sel3','sel_id_3','');
$sc_ajax_select_boxes->add_select_box('town_lookup_sub_sub','sub_type','town','sub_type','st22','sel4','sel_id_4','');
$sc_ajax_select_boxes->link_select_boxes('sel1','sel2', 'town_id','t2');
$sc_ajax_select_boxes->link_select_boxes('sel2','sel3', 'town_id','st22');
$sc_ajax_select_boxes->link_select_boxes('sel3','sel4', 'town_id','st22');
$sc_ajax_select_boxes->place_jscripts();
$sc_ajax_select_boxes->show_select_box('sel1');
$sc_ajax_select_boxes->show_select_box('sel2');
$sc_ajax_select_boxes->show_select_box('sel3');
$sc_ajax_select_boxes->show_select_box('sel4'); ?>
This is a direct copy and paste of the script in the example.php file which works just fine. I have also added the reference to the prototype.js file as well but it also has no effect.
Any ideas what might be happening. The form action is
<form action="index.php" method="get">
Thanks
Nick