I have a form with 2 select boxes and text boxes, my aim is to display some values from my database based on the value selected from the previous select box, but I need to do it inside the same page without submitting the form.
<form id="form5" method="post" action="hello.php"><div id="right">
<fieldset>
<input type="hidden" name="hid2" value="hid2"><br>
<h3>
<br><br>
<label for="loca">Select Location:</label>
<select name="locat" id="locat">
<option value="">Select Location:</option>
<option value="1">ALAPPUZHA</option>
<option value="2 ">CALICUT</option>
<option value="3">COCHIN</option>
<option value="4">KANNUR</option>
<option value="5">KOLLAM</option>
<option value="6 ">KOTTAYAM</option>
<option value="7">MALAPPURAMM</option>
<option value="8">PALAKKAD</option>
<option value="9">PATHANAMTHITTA</option>
<option value="10">THRISSUR</option>
<option value="11">TRIVANDRUM</option>
</select><br>
<select name="place" id="place">
<option value="">Select Location:</option>
<option value=""></option>
<option value=""></option>
</select>
<button type="submit">submit</button>
<br></h3>
</fieldset>
</form></div>
I'd recommend getting the two database queries you need on load, and displaying their results based on the selection. So your target would be to load the database entries on page load, rather than on html change and then display them how you see fit.