+ 2
How to make the data that the user write it in textbox in html web go to data table in php my admin? Please write the code
3 ответов
+ 5
index.html
<form action="processdata.php" method="post">
<input type="text" name="info">
<button type="submit">Send data</button>
</form>
processdata.php
// get the data
$info = filter_input(INPUT_POST, 'info', FILTER_SANITIZE_SPECIAL_CHARS);
// db connection
$host = "localhost";
$dbname = "test";
$user = "root";
$pass = "password";
$conn = new PDO("mysql:host=$host;dbname=$dbname","$user","$pass");
// statement
$stmt = $conn->prepare("INSERT INTO test (column_name) VALUES (?)");
$stmt->bind_param("s", $info);
$stmt->execute();
+ 4
You are welcome. Do you need some explanation of the code or any other help with processing data?
+ 3
thanks for your answer