php variable with data insert into mysql, PHP mysqli insert variables into database, php code for inserting data into database from form

Use $ to create php variables, like if I want to create a php variable by name, then I will write $name, it is a php variable, it does not have any value, to give value I have to write $name = “Indian” ;

 

inlucde("connection.php");                                                                     $name = "Naresh"; 
         $address = "dausa rajasthan indian 303303"; 
         $mobileno = "9787876XXX"; 
         $email = "naresh@gmail.com"                            $query="INSERT INTO `formtable` (`id`, `name`, `address`,  `mobileno`,`email`,) VALUES (NULL, '$name', '$address', '$mobileno','$email');";                                                   $data = mysqli_query($connection,$query);                             if ($data==TRUE) { echo "Add Successfully"; }else{ echo "Not Add"; }             ?>
HTML
So by making php varriable something like this you can get the data inserted in the database.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *