选择表单选项不会显示在PHP结果

时间:2018-05-26 15:15:13

标签: php forms post html-select

我在HTML中有一行提交但其中一个没有显示在PHP结果中。对我而言,似乎我以同样的方式做了所有事情,但仍然缺少一行文字。我需要尽快回答,因为我需要一个计算机科学项目。

这是我的HTML代码:

<!DOCTYPE html>
<html>
  <head>
    <title>Bestelformulier</title>
    <link rel="icon" href="olifanty.ico" />
    <style>
    body {
      text-align:left;
      background-image:url(pc.png);
      background-position:fill;
    }
    fieldset {
      display:inline-block;
      color:black;
      background-color:#43ff26;
    }
    .radio {
      text-align:left;
    }
    </style>
  </head>
  <form action="bestelform.php" method="post">
    <br><br><br> <fieldset>
    <h1>Create Account</h1>
    Naam:      <br><input type="text" name="naam" color=black placeholder="van je ouders gekregen" required><br>
    Adres:      <br><input type="text" name="adres"  placeholder="waar je woont"required><br>
    Woonplaats:    <br><input type="text" name="woonplaats" placeholder="ook waar je woont"required><br>
    E-mail:      <br><input type="text" name="e-mail" placeholder="@@@@@@@@@@@@"required><br>
    Telefoonnummer:  <br><input type="text" name="telefoonnummer" placeholder="nu ga ik je bellen"required><br>
    Geslacht:    <div class="radio">
            <input type="radio" name="geslacht" value="Man"required>Man
            <br><input type="radio" name="geslacht" value="Vrouw"required>Vrouw
            <br><input type="radio" name="geslacht" value="Anders"required>Ander
            <br> </div>
    <h2>Onderdelen</h2>
    Processor:&emsp;&emsp;&emsp;&emsp;<select name="processor"><option value="Intel Core i3">Intel Core i3</option>
                <option value="Intel Core i5">Intel Core i5</option>
                <option value="Intel Core i7">Intel Core i7</option></select><br>
    Moederbord:&emsp;&emsp;&emsp;<select name="moederbord"><option value="Asus ROG Maximus X Hero">Asus ROG Maximus X Hero</option>
                <option value="Asus PRIME Z370-A">Asus PRIME Z370-A</option>
                <option value="Asus PRIME X299-DELUXE">Asus PRIME X299-DELUXE</option></select><br>
    RAM geheugen:&emsp;&emsp;<select name="ram"><option value="Kingston HyperX FURY 8G">Kingston HyperX FURY 8G</option>
                <option value="Kingston HyperX FURY 8G X2">Kingston HyperX FURY 8G X2</option>
                <option value="Kingston HyperX FURY 8G X4">Kingston HyperX FURY 8G X4</option></select><br>
    Behuizing:&emsp;&emsp;&emsp;&emsp;<select name="behuizing"><option value="NZXT S340 Zwart">NZXT S340 Zwart</option>
                <option value="NZXT S340 Wit">NZXT S340 Wit</option>
                <option value="NZXT S340 Grijs">NZXT S340 Grijs</option></select><br>
    Grafische kaart:&emsp;&emsp;<select name="grafische"><option value="MSI gtx 1080">MSI gtx 1080</option>
                <option value="MSI gtx 1070">MSI gtx 1070</option>
                <option value="MSI gtx 1060">MSI gtx 1060</option></select><br>
    Opslag:&emsp;&emsp;&emsp;&emsp;&emsp;<select name="opslag"><option value="Samsung SSD 250 GB">Samsung SSD 250 GB</option>
                <option value="Samsung SSD 500 GB">Samsung SSD 500 GB</option>
                <option value="Samsung SSD 1000 GB">Samsung SSD 1000 GB</option></select><br>
    Voeding:&emsp;&emsp;&emsp;&emsp;&emsp;<select name="voeding"><option value="Corsair VS Series VS650">Corsair VS Series VS650</option>
                <option value="Chieftec A-90 Series GDP-750C">Chieftec A-90 Series GDP-750C</option>
                <option value="EVGA Supernova 1300 G2">EVGA Supernova 1300 G2</option></select><br>
    Vragen:<br><textarea placeholder="pls no" rows="2" cols="55" name="vragen"></textarea><br>
                &emsp;&emsp;&emsp;&emsp;&emsp;&emsp;<input type="image" src="img_submit.gif" alt="Submit"
    </fieldset>
  </form>
</html>

这是我的PHP代码:

<!DOCTYPE html>
<html>
<body style="background-color:powderblue;">
<h1>Welkom <?php echo $_POST["naam"]; ?></h1><br>
<h2>U woont op <?php echo $_POST["adres"]; ?>&emsp;
In <?php echo $_POST["woonplaats"]; ?><br>
Er wordt een verificatie mail verstuurd naar <?php echo $_POST["e-mail"]; ?><br>
We kunnen je nu bellen met het nummer <?php echo $_POST["telefoonnummer"]; ?><br>
Uw geslacht is: <?php echo $_POST["geslacht"]; ?></h2><br>
<h2>Uw bestelling:</h2>
<ul>
  <li><?php echo $_POST["processor"]; ?></li>
  <li><?php echo $_POST["moederbord"]; ?></li>
  <li><?php echo $_POST["ram"]; ?></li>
  <li><?php echo $_POST["behuizing"]; ?></li>
  <li><?php echo $_POST["grafische"]; ?></li>
  <li><?php echo $_POST["opslag"]; ?></li>
  <li><?php echo $_POST['voeding']; ?></li>
</ul>
ERROR 1265: We hebben geen antwoord gevonden up uw vraag:<?php echo $_POST["vragen"]; ?>
</body>
</html>

第五个列表项目似乎无效,但我似乎无法找出原因。我已经检查了有关此问题的所有其他内容,但我仍无法找到问题的答案。

1 个答案:

答案 0 :(得分:0)

您的代码看起来很好。

查看html和php文件的编码。它们必须是UTF-8 使用UTF-8编码类型保存文件。