PHP+html表单post提交到数据库(表单+预选下拉列表)代码
2020-11-15学无止境南夏247°c
A+ A-<html> <head> <meta charset="utf-8"> <title>微信公众号文章采集</title> <form action="" method="post"> <input type="text" name="link" style="width:545px;height:35px"/> <select name="type"> <option type="text" selected>微信文章</option> <option type="text">采集网址</option> <option type="text">游戏内容</option> <option type="text">其它</option> </select> <hr> <input type="submit" name="submit" value="提交" style="width:545px;height:35px"/> </form> </html> <?php include("../data/database.php"); $nanxia = $_POST['link']; $nanxia_1 = $_POST['type']; if($nanxia <> null){ //$conn = new mysqli('数据库地址','用户','密码','数据库名'); $sql = "INSERT INTO nanxia_WeChat (link,type) VALUES ('$nanxia','$nanxia_1')"; $conn->query($sql); $conn->close(); echo "提交成功"; } else{ echo "请填写链接"; } ?>
未定义标签