2012-08-28 207 views
0

nw_check.php执行sql查询点击

<?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回声。请你帮忙。

+0

是*或者*回声'nw_check_exec.php'正在执行? – mellamokb

回答

1

我想这是因为输入类型为“按钮”,应该是提交:

<input type="submit" name="nw_update" value="NW_Update"/>