how do I run a php file after html form submission | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how do I run a php file after html form submission

I have been trying to run a php file after the submission of an html form. i have been using the action attribute but it just shows the code instead of running it. thank you in advance

23rd Nov 2019, 12:02 AM
Conrad
2 Answers
+ 5
Conrad Before running php file you need to connect your database from your html page so that the data can be fetched and sent from form and stored in the database in php you need to take care of case used in variables as its case sensitive you should use $_POST in global variables. In storing database with php you need to first write the connection code. After writing the connection code you need to use this way And in later part for login you can use $_SESSION variable and assign session to user. connection code is written in this way <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("db_name", $con); ?> https://code.sololearn.com/wNJIukAbu15e/?ref=app https://code.sololearn.com/wL1nTD46BZuX/?ref=app
23rd Nov 2019, 5:39 AM
GAWEN STEASY
GAWEN STEASY - avatar
- 1
Thanks for the explanation! You Rock! ;)
23rd Nov 2019, 1:23 AM
Lev