当我点击提交按钮时,没有任何反应。也许数据库没有连接。我正在尝试使用 php 和 html 制作表格。我正在使用 xampp,我在记事本 ++ 中编写了代码,并将 form.php 保存在 htdocs 中。我不知道出了什么问题。也许是我用于变量的名称。这是 html 代码: <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> </head> <body> <form method="post" action="C:\xampp\htdocs\form.php"> Nume de utilizator : <input type="text" name="nume_de_utilizator" placeholder="Enter Your Name" > Email : <input type="text" name="email" placeholder="Enter Your Email"> Parola: <input type="password" name="parola"> <input type="submit" value="submit" > </form> </body> </html>this is form.php<?php$servername = "localhost";$username = "root";$password = "";$dbname = "autentificare";// Create connection$conn = mysqli_connect($servername, $username, $password, $dbname);// Check connectionif (!$conn) { die("Connection failed: " . mysqli_connect_error());}$nume_de_utilizator = mysqli_real_escape_string($conn, $_POST['nume_de_utilizator']);$email = mysqli_real_escape_string($conn, $_POST['email']);$parola = mysqli_real_escape_string($conn, $_POST['parola']);// Attempt insert query execution$sql = "INSERT INTO utilizatori (nume_de_utilizator, email, parola) VALUES ('$nume_de_utilizator', '$email', '$parola')";if(mysqli_query($conn, $sql)) printf("%d Row inserted.\n", mysqli_affected_rows($con));else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($conn);}// Close connectionmysqli_close($conn);?>这是“autentificare”,数据库 我的数据库
1 回答
长风秋雁
TA贡献1757条经验 获得超7个赞
尝试查看“在线链接”,例如:“ http://localhost:8080/form.php ”
做一个简单的echo msg
文件检查并替换action="C:\xampp\htdocs\form.php"
为action=http_link
- 1 回答
- 0 关注
- 130 浏览
添加回答
举报
0/150
提交
取消