How to validate form (created using html) and include it data to database? I want validate using jscript and insert data using php.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin MukherjeePosted Jul 31, 2014, 10:08 AM
Shashank SrivastavaPosted Jul 2, 2014, 7:26 AM
insert.php
$user = $_POST['user'];
$pass = $_POST['pass'];
$email = $_POST['email'];
$host = "localhost";
$username = "root";
$password = "";
$db = "database_name";
$connect = mysqli_connect($host, $username, $password, $db);
if(!$connect) echo "could not connect";
else
{
$query = "INSERT INTO table_name (username_column, password_column, email_column) VALUES ($user, $pass, $email)";
$result = mysqli_query($connect, $query);
if(!$result) echo "could not insert";
else echo "record inserted";
}
mysqli_close($connect);
?>
I hope it helps.
Srikanth ReddyPosted Jul 2, 2014, 5:45 AM
ishan fernandoPosted Jul 2, 2014, 4:57 AM
Srikanth ReddyPosted Jul 2, 2014, 4:39 AM
http://stackoverflow.com/questions/8192355/javascript-validation-with-php-sample-1