i have a problem with some javascript and php code. I want to tried a few things with some ajax calls which did not work.
What i want to happen: When i change the selected option it need to update the function with the value from the option, so the php function get the "id" from the selected option. And this need to happen without any refresh on the page.
So i need to get the value from the selected item to the php function.
Code:
<div class="form-label">Category</div>
<select name="category">
<option></option>
<?php
$categories = $food->categories();
foreach($categories as $category){
?>
<option value="<?php echo $category->MainGrp; ?>"><?php echo $category->NameDK; ?></option>
<?php
} ?>
</select>
</div>
<br>
<div>
<?php
$meals = $food->mealsByCategory($id);
foreach($meals as $meal){
?>
<div class="entry style-columns">
<div class="entry-title">
<a href="#"><?php echo $meal->DanName; ?></a>
</div>
</div>
<?php
}
?>
Aucun commentaire:
Enregistrer un commentaire