I am building a comics/artwork website that will let you search for material. The website will have two sub sites, comics and artwork. When the user selects a sub site, it will only display those images (comics or artwork). When they search, I’d also like to pass in a “sub site” parameter which will return either comics or artwork.
Therefore, for my search functionality, I’d like to pass multiple parameters to the search function- (search string, subsite).
I have the following search box: (how do I pass in subsite to the html search?)
$subsite = (isset($_GET['subsite']) ? ($_GET['subsite']) : null);
<span class="search"><input type="text" onkeyup="search(this.value)" name="input" value="" /></span>
That input is passed to this JQuery:
function search() {
$.get("./scripts/search.php", {"_input" : $('input[name=input]').val(), "_subsite" : $('input[name=subsite]').val()},
function(returned_data) {
$("#output").html(returned_data);
}
);
}
PHP: Search.php
$input = (isset($_GET['_input']) ? ($_GET['_input']) : 0);
$subsite = (isset($_GET['_subsite']) ? ($_GET['_subsite']) : null);
echo "SEARCH SITE = " . $subsite;
//This echos out nothing... it should be the subsite, either "artwork" or "comics"
I’m trying to get my comics website to go live, but I can’t get this to work. Any suggestions? Thanks!
.