Пример #1
0
<?php

$type_id = $_POST['item'];
require_once 'ConnectDB.php';
$db = new ConnectDB();
$get_food_name = $db->db_accessor("DISTINCT id, japanese", "Mlang", "type_id = '{$type_id}'");
$html = $get_food_name;
header('Content-type: application/json');
//指定されたデータタイプに応じたヘッダーを出力する
echo json_encode($html);
    }
    $j++;
}
for ($j = 0; $j < $foodCount; $j++) {
    $item[$j] .= "</div>";
    $item[$j] .= "<div class=\"middle-box\">";
}
// 選択された言語で料理名を表示
for ($j = 0; $j < $foodCount; $j++) {
    $item[$j] .= "<div class=\"lang-box\">";
}
foreach ($langSelects as $key => $language) {
    if ($language == "chinese") {
        $j = 0;
        foreach ($foodNameBoxes as $Key => $id) {
            $get_chinese = $db->db_accessor("id, chinese", "Mlang", "id = {$id}");
            $item[$j] .= "<p>" . $get_chinese[0]['chinese'] . "</p>";
            $j++;
        }
    }
    if ($language == "japanese") {
        $j = 0;
        foreach ($foodNameBoxes as $Key => $id) {
            $get_japanese = $db->db_accessor("id, japanese", "Mlang", "id = {$id}");
            $item[$j] .= "<p>" . $get_japanese[0]['japanese'] . "</p>";
            $j++;
        }
    }
}
for ($j = 0; $j < $foodCount; $j++) {
    $item[$j] .= "</div>";
require_once 'ConnectDB.php';
?>


<li id="food-box-template" class="item-box">
<input type="hidden" name="foodBoxId">

  <div class="row">
    <div class="col-md-4">
      <div class="form-group">
        <label for="exampleInputEmail1">料理の種類</label>
        <select name="kindBox" class="kind-box form-control">

          <?php 
$db = new ConnectDB();
$get_type = $db->db_accessor("DISTINCT type_id, type", "Mlang", "id >= 1");
?>

          <option>種類を選択してください</option>

          <?php 
$i = 0;
foreach ($get_type as $key => $value) {
    ?>
            <option value="<?php 
    echo $value['type_id'];
    ?>
">
              <?php 
    echo $value['type'];
    ?>