I have an HTML Select List that has the ABC's in it. When I select one of the alphabet letters this in turn returns only the records starting with that letter. The HTML part works fine. The Javascript part seems to be getting the value, I see the correct value when I put an alert on it. The MySQL query works fine in PHP admin. But for someon reason when its put all together I get nothing. Here is what I have so far.
The HTML Select.
<form name="Alphabets" method="post" action="">
<select name="Alpha" id="Alpha" class="slideSelect1">
<option value="" data-image-src="../Images/Buttons/A.png">SS</option>
<option value="A" data-image-src="../Images/Buttons/A.png">A</option>
<option value="B" data-image-src="../Images/Buttons/B.png">B</option>
</select>
<input type="hidden" input name="Letter" id="Letter">
</form>
The JavaScript.
$(document).ready(function()
{
$("#Alpha").change(function()
{
var Letter = $(this).val();
$.ajax({
type: "POST",
url: "alpha_search.php",
data: {"Letter":Letter},
cache: false,
success: function (html) {
//alert (Letter);
$("#RestMenus").html(html);
}
});
});
});
The PHP....
<?php
require('config.php');
$Letter=$_POST['Letter'];
$sql=mysql_query("SELECT tblLocations.LocationID as Lid, tblRestaurants.RestName, tblLocations.MenuPage
FROM
tblRestaurants
INNER JOIN tblLocations ON tblRestaurants.RestID = tblLocations.RestID
WHERE tblRestaurants.RestName LIKE 'Letter%'
ORDER BY tblRestaurants.RestName ASC");
echo '<option selected="selected">--Select Restaurant--</option>';
while($row=mysql_fetch_array($sql))
{
echo '<option value="'.$row['Lid'].'">'.$row['RestName'].'</option>';
}
?>
Help is appreciated. Thank you.