1

nw_check.php

<?php
  $con = mysql_connect("localhost","root","12345");
  if (!$con)
  {
    die('Could not connect: ' . mysql_error());
  }
?>

 <html>
 <body>
    <form method="POST" action="nw_check_exec.php">
        <input type="button" name="nw_update" value="NW_Update"/>
    </form>
</body>
</html>

nw_check_exec.php

<?php
    if(isset($_POST['nw_update'])){
        echo("You clicked button one!");
        //and then execute a sql query here
    }
    else {
    echo" dhur";
    }
?>

しかし、何らかの理由で nw_check_exec.php のエコーが実行されていません。助けてください。

4

1 に答える 1

3

入力タイプが「ボタン」であり、送信する必要があるためだと思います。

<input type="submit" name="nw_update" value="NW_Update"/>
于 2012-08-28T19:52:37.730 に答える