當我點擊提交按鈕時,沒有任何反應。也許數(shù)據(jù)庫沒有連接。我正在嘗試使用 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”,數(shù)據(jù)庫 我的數(shù)據(jù)庫
1 回答

長風秋雁
TA貢獻1757條經(jīng)驗 獲得超7個贊
嘗試查看“在線鏈接”,例如:“ http://localhost:8080/form.php ”
做一個簡單的echo msg
文件檢查并替換action="C:\xampp\htdocs\form.php"
為action=http_link
- 1 回答
- 0 關注
- 164 瀏覽
添加回答
舉報
0/150
提交
取消