0

How to apply database to HTML to collect data from a form???

For years I've been trying to develop a simple website that contains a contact form asking for name, email, and a body of text just to try to apply something that collects the information from each text field and inserts it into a database. I already tried to use HTML> JavaScript> JSON but I always have problems with Node.JS, and I also tried HTML> PHP> SQL but I can't link HTML information to PHP or SQL database Does anyone know of any good youtube tutorial or website that can teach me how to create a form, and insert this form data into a file like JSON, XML or SQL ???

4th Oct 2019, 7:06 AM
Wardy Spirit
Wardy Spirit - avatar
1 Resposta
+ 1
https://www.w3schools.com/html/html_forms.asp And you can access this form with the global variables $_GET and $_POST in PHP After that you have to make a new mysqli object like this $mysqli = new mysqli(127.0.0.1, "dbusername", "dbpassword", "db to open") And send the data to the mysql server like this $mysqli->query("INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);"); Ps.: Please sanitizie your inputs https://stackoverflow.com/questions/129677/how-can-i-sanitize-user-input-with-php#130323
4th Oct 2019, 7:26 AM
Nico Ruder
Nico Ruder - avatar