view raw
Tye Lucas Tye Lucas - 11 months ago 58
Javascript Question

Adding Jquery select dropdown box to refine search using raphael USA map

I am using a jquery map to populate my url by state clicked. For example, when someone clicks WA state from the map the url is updated to, I am using

if(isset($_SERVER[ 'QUERY_STRING' ])) {
$state = escape($_SERVER[ 'QUERY_STRING' ]);

to capture the url query being passed so I can search in MYSQL and pull up all results in WA state. It's working perfectly! I also wish to add a select dropdown to the mix so class names can be searched by state and by class id. The problem is I am having difficulty populating the url properly with the added values from the select in order to refine my search. Does anyone have any idea how to do this? I am using raphael.js for the map. The select drop down would be providing the value class_id with all the values I have for my classes.

USA JQuery Map

I have

$(".classpicker").change(function () {

var selectedtext = $(".classpicker option:selected").html();
// alert("select value of contact type is" + selectedtext);
<?php $url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; ?>
window.location = "<?php echo $url . '?'; ?>" + this.value;


// If a value is passed to the url from either map or dropdown JQuery or search field
if(isset($_GET['p_id'])) {

$value = escape($_GET[ 'p_id' ]);

    if(ctype_alpha($value)) { // If it's letters

        $state = escape($_GET[ 'p_id' ]);

    } else { // otherwise it's an integar

        $class = escape($_GET[ 'p_id' ]);