I want to take the POST data from the three form tags and upload variables to mySQL. When I run the PHP on the second page I get a "Parse error: syntax error, unexpected 'VALUES' (T_STRING) in C:\xampp\htdocs\PHPtest\signUpTRUE.php on line 32"
I can try to post the HTML Form Tags and the PHP..
The HTML form tags:
<div id="headingText"><p> New Fan Club Registration</p></div>
<form action="signUpTRUE.php" method="post" >
<div id="firstNameField">First Name:<input type="text" name="fname"></br></div>
<div id="lastNameField">Last Name: <input type="text" name="lname"></br></div>
<div id="emailField">Email: <input type="text" name="email"></br></div>
<div id="checkboxField"><input type="checkbox" name="terms" value="agree" id="checkboxField" required> *Agree to the <a href="newText.php" id="termsLink">terms and conditions</a> </input></div>
<button type="submit" value="Submit" id="button">Submit</button>
</form>
Here is the PHP running calls to mySQL:
<?php
$FN = htmlspecialchars($_POST['fname']);
$LN = htmlspecialchars($_POST['lname']);
$EM = htmlspecialchars($_POST['email']);
$servername = "localhost";
$username = "root";
$password = "password";
$dbname = "fanClub";
$conn = new mysqli($servername,$username,$password,$dbname);
if ($conn->connect_error) {
die("Connection Failed: " . $conn->connect_error);
}
$sql = "INSERT INTO userInfo (email, firstname, lastname)"
VALUES ($EM, $FN, $LN);
if ($conn->query($sql) === TRUE) {
echo "<p> data enrty has been logged like whoa</p>";
}else {
echo"<p>error in code.</p>";
}
$conn-close();
?>
I get the
"Parse error: syntax error, unexpected 'VALUES' (T_STRING) in C:\xampp\htdocs\PHPtest\signUpTRUE.php on line 32"
when I try to run this.
Thanks a lot for looking at this :D!