PHP提交表单数据时php不做任何事情

时间:2015-10-01 19:20:33

标签: php html forms

我正在学习PHP而且我遇到了问题 我创建了一个页面,其中有一个字段可以插入答案,因此您可以转到下一页并获得答案;但是php只返回一个空白页面。这是index.html代码:

<html>
<head>
<style>
body{background-color:#0288D1;}
</style>
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/css/materialize.min.css">

  <!-- Compiled and minified JavaScript -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/js/materialize.min.js"></script>

<link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
      <!--Import materialize.css-->
      <link type="text/css" rel="stylesheet" href="css/materialize.min.css"  media="screen,projection"/>

      <!--Let browser know website is optimized for mobile-->
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<h1 style="text-align: center;"><span style="font-family:trebuchet ms,helvetica,sans-serif;">What is Watch Dogs ?</span></h1>


    <form class="col s12"  action="form.php" method="post">
          <input name='answer'>Answer here</input>
          </form>



  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
      <script type="text/javascript" src="js/materialize.min.js"></script>
</body>
</html>

这是form.php代码

<?php
ini_set('display_startup_errors',1);
ini_set('display_errors',1);
error_reporting(-1);
?>
<html>
<body>

<?php
    $answer = $_POST['answer'];

if($odgovor == "Game"){
echo "<p>Correct visit this link to answer the second question: www.something.something.com</p>"
}
else{
echo "<p>*Insert Nelson's Laugh here* You answered wrong</p>"
}

?>

    </body>
</html>

0 个答案:

没有答案