Im trying to store form data on mySQL but for some reason, i'm getting an error on my 7th line of code which is Parse error: syntax error, unexpected 'if' (T_IF) in C:\xampp\htdocs\testdata\register.php on line 7
on if($_POST['first_name'] != "" && $_POST['last_name'] != "" && $_POST['email'] != "") {
I've done some research on the error, most people are mentioning that it's something got to do with a missing semicolon but i dont think a semicolon is missing in the code but would be great if someone can look at it also.
my entire code:
<?php session_start(); include_once("db.php"); // includes the db file into this page. if($_POST['first_name']) ($_POST['last_name'] ($_POST['email'])) { if($_POST['first_name'] != "" && $_POST['last_name'] != "" && $_POST['email'] != "") { $first = $_POST['first_name']; $last = $_POST['last_name']; $mail = $_POST['email']; $sql_store = "INSERT into names (id, first, last, email) VALUES (NULL, '$first', '$last', '$mail' )"; $sql = mysqli_query($db, $sql_store) or die(mysql_error()); } else { echo "You need to to enter data in the boxes. "; } } else { echo "You need to to enter data in the boxes. "; } ?>
https://stackoverflow.com/questions/65386340/cant-store-data-to-mysql December 21, 2020 at 09:03AM
没有评论:
发表评论