Hi, I have a script which allows the user to choose an animal from a drop down menu, and then changes an image on the page based on what animal they chose
[CODE]<script type=”text/javascript”>
$(function() {
$(‘select’).change(function() {
var val = $(this).val();
if(val == “”){
document.getElementById(‘Image’).innerHTML = “”;
}else{
var Image = ‘<img id=”Image” src=”Images\’+val+’.png” />’;
document.getElementById(‘Image’).innerHTML = Image;
}
});
});
</script>
<select>
<option value=””>Choose an animal</option>
<option value=”Cat”>Cat</option>
<option value=”Dog”>Dog</option>
<option value=”CatDog”>CatDog</option>
</select>
<div id=”Image”></div>
This is working fine for me, however, i now want to make it so that when the user picks an option from the menu, the rest of the page is then updated with information which is fetched from a database. I know that PHP and JavaScript work in very different ways, but I need a way to pass the variable from the JavaScript containing the option that they selected to a PHP variable, that i can use within an SQL statement, but am really struggling with how I can do this, any help much appreciated.