我正在尝试做一个网站(不要问它是什么),我需要帮助。我创建了这个名为 meallist.php 的页面:
<?php
/* Ingredients List */
$meatlist = array(tavuketi => "Tavuk Eti",
baliketi => "Balık Eti");
$vegelist = array(domates => "Domates",
patates => "Patates",
salatalik => "Salatalık");
/* The Meals - dun dun duuuunnnnnn */
$yemekaralist = array(mangaldatavuk => array(
name => "Mangalda Tavuk",
ing1 => tavuketi),
mangaldapatateslitavuk => array(
name => "Mangalda Patatesli Tavuk",
ing1 => tavuketi,
ing2 => patates),
mangaldabalik => array(
name => "Mangalda Balık",
ing1 => baliketi),
firindapatateslibalik => array(
name => "Fırında Patatesli Balık",
ing1 => baliketi,
ing2 => patates));
?>
你明白了。我在 index.php 上创建了一个 foreach 循环,它创建了一个选择:
<div id="etler">
<select multiple="multiple" name="selectMeal[]" size="4" data-max-length="30">
<?php
foreach($meatlist as $id => $name)
{
print "<option value=\"" . $id . "\">" . $name . "</option>";
}
?>
</select>
</div>
<div id="sebze">
<select multiple="multiple" name="selectMeal[]" size="4" data-max-length="30">
<?php
foreach($vegelist as $id1 => $name1)
{
print "<option value=\"" . $id1 . "\">" . $name1 . "</option>";
}
?>
</select>
</div>
它发布 selectMeal[] 并将其放入 searchmeal.php 中的 $search 中。我想要的是,我希望它搜索 meallist.php 中的 $yemekaralist 并检查 ing1 (如果可用,则 ing2 )是否与 selectMeal[] 数组匹配,如果可用则打印 name => "something"。我怎样才能做到这一点?
最好的问候,mission712