执行按钮单击SQL查询 [英] execute sql query on button click

查看:204
本文介绍了执行按钮单击SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

nw_check.php

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

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回声。请您能有所帮助。

but for some reason the echo in the nw_check_exec.php is not being executed. please could you help.

推荐答案

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

I think it's because the input type is a "button" and should be a submit:

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

这篇关于执行按钮单击SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆