如何在Html中单击按钮后将数据导入数据库 [英] How Do I Get Data Into A Database After The Click Of A Button In Html
问题描述
你好
我试图创建一个网站并尝试在点击提交按钮后将数据输入数据库。
i有三个网页上的文字字段名称为
.UName
.EnterEmail
.passwordsignuptextbox
和按钮名称是
.signupbutton
我的目标是点击注册按钮后它发送的数据在三个文本字段进入数据库。到目前为止这是我的PHP代码
include_once'db_connect.php';
if(isset($ _POST ['signupbutton'])){
$ uname = $ _POST ['UName'];
$ email = $ _POST ['EnterEmail'];
$ password = $ _ POST ['passwordsignuptextbox'];
if(mysqli_query($ conx,INSERT INTO registration(UserName,Email,user_password)
。VALUES( $ uname,$ email,$ password)))
echo插入好;
else {
echo插入数据时的错误;
}
mysqli_close($ conx);
}
?>
i继续收到错误请帮助
hello
am trying to create a website and trying to get data into the database after clicking the submit button .
i have three text field on the webpage their names are
.UName
.EnterEmail
.passwordsignuptextbox
and the button name is
.signupbutton
my goal is after clicking the signupbutton it send the data which is in the three text field into the database .so far this is my php code
include_once 'db_connect.php';
if(isset ($_POST['signupbutton'])) {
$uname= $_POST['UName'];
$email= $_POST['EnterEmail'];
$password=$_POST['passwordsignuptextbox'];
if (mysqli_query($conx , "INSERT INTO registration ( UserName, Email,user_password)"
. "VALUES( $uname,$email,$password)" ))
echo "inserted okay";
else {
echo " erros upon inserting data";
}
mysqli_close($conx);
}
?>
i keep on getting errors please help
推荐答案
_POST ['signupbutton'])){
_POST['signupbutton'])) {
uname =
_POST ['UName'];
_POST['UName'];
这篇关于如何在Html中单击按钮后将数据导入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!