<!-- Search input -->
<form method="post" action="query.php" id="searchform" name="search" class="search">
<input id="inpBusiness" type="text" placeholder="Find a Business by Name" name="Business"/>
<input id="inpLocation" type="text" placeholder="Or by a Massachusetts City/Town" name="City"/>
<input id="btnSearch" type="submit" value="Search VetsDirectory" name="btnSearch"/><br/>
</form>
<hr />
</td>
</tr>
<tr>
<td>
<!-- This is where the featured listings and search Query will load -->
<h3 align="left">FEATURED BUSINESS LISTINGS:</h3>
<div id="inputhere">
<?PHP
include 'php.php';
?>
</div>
This is my form, upon submit, I need to check if a user used the inpBusiness or inpLocation to search. If they used location to search, I need the action to be query.php, if they used business to search I need action to be query2.php, if both or neither are used populate an error to basically say "pick one"
After this check. I need query.php or query2.php to populate where php.php is included inside the #inputhere div, I need it to clear php.php from that div, then append either query or query 2 based upon input.
UPDATE:
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script>
$(document).ready(function () {
var $article = null;
$('#searchform').submit(function () {
if ($article == null) {
$("#inputhere").load("query.php").appendTo('.inputhere');
}
});
});
</script>
Without changing anything in my form, I am attempting to now just load the form into the div, but it is still redirecting me immediately to a new page displaying query.php, which I can see it loading it into the div right before the redirect. Any ideas?
Last one:
<script src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script>
$(document).ready(function () {
var $article = null;
$('#searchform').submit(function (e) {
e.preventDefault();
if ($article == null) {
$("#inputhere")).html('Loading...').load('query.php');
}
});
});
</script>
Its still loading the query on a separate page. As can be seen on my server @ www.masswarveterans.com