0

How to get information filled by the user in my html form

htlm and database

9th Sep 2017, 6:28 PM
Shamun Surajo Chiroma
Shamun Surajo Chiroma - avatar
5 Réponses
+ 3
You need a server-side application to receive the information. The method will vary depending on what you use. Try learning more about the matter, or ask more specific questions.
9th Sep 2017, 6:41 PM
Dao
Dao - avatar
+ 2
I don't understand the fixation with pointing towards PHP. Yes, somehow, it's still the most relevant server-side language, but there's no guarantee that PHP is what he wants, and Ruby on Rails/Node.js are plenty popular as well. I personally suggest Node if you're up for building the server application yourself, and Rails if you want something easier.
9th Sep 2017, 8:25 PM
Dao
Dao - avatar
+ 2
You need PHP and Mysql. Below is the Php code that performs create new database data of username and email upon form submission. (rυn ιт ғroм a php weв ѕerver wιтн мyѕql dв setup, noт ғroм code playgroυnd) <!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"> <title>Add Email Form</title> </head> <body> <form method="post"> <p> <label for="name">Username:</label> <input type="text" name="name" id="name"> </p> <p> <label for="email">Email Address:</label> <input type="text" name="email" id="email"> </p> <input type="submit" value="Send"> </form> </body> </html> <?php if(!empty($_POST['name']) && !empty($_POST['email'])) { $link = mysqli_connect("localhost", "root", "password", "demo"); // Check connection demo database if($link === false){ die("ERROR: Could not connect. " . mysqli_connect_error()); } // Escape user inputs for security $name = mysqli_real_escape_string($link, $_POST['name']); $email = mysqli_real_escape_string($link, $_POST['email']); // attempt insert query execution $sql = "INSERT INTO persons (name, email) VALUES ('$name', '$email')"; if(mysqli_query($link, $sql)){ echo "Records added successfully."; } else{ echo "ERROR: Could not able to execute $sql. " . mysqli_error($link); } // close connection mysqli_close($link); } ?> https://code.sololearn.com/w8uC90WWcV3D/?ref=app
10th Sep 2017, 12:01 AM
Calviղ
Calviղ - avatar
0
Most likely with PHP
9th Sep 2017, 6:33 PM
Tom
Tom - avatar