I am currently trying to send data from an HTML form (Proform.html) to a MYSQL database. I cannot figure out how to solve this problem that keeps occurring as I am new to php the error message I keep receiving is.
"Fatal error: Call to a member function query() on a non-object in C:\xampp\htdocs\php\Proform.php on line 22"
It could be possable as I have used several different references to create this page of code that i have mixxed two different realeases of php. Though help would be appriciated Anyways code is as follows.
<?php
$dbname='*****';
$dbhost='localhost';
$dbpass='******';
$dbuser='******';
$dbhandle = mysql_connect($dbhost, $dbuser, $dbpass)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
//select a database to work with
$selected = mysql_select_db("ecig",$dbhandle)
or die("Could not select examples");
$q = $dbhandle->query("INSERT INTO Persons (First_Name, Last_Name)
VALUES ('$_POST[First_Name]', yes)");
if (array_key_exists ('check_submit', $_POST ))
echo "Your Name is : {$_POST['First_Name']}<br />";
echo "Your Second Name is : {$_POST['Second_Name']}<br />";
echo "Your Email Address is : {$_POST['Email_Address']}<br />";
echo "Your Password Is : {$_POST['Password']}<br />";
?>