This question already has an answer here:
Alright so I am currently trying to make a system to take applications and it was working until I added the rest of the questions :
<?php
include_once('db.php');
$user =$_POST['username'];
$job =$_POST['job'];
$active =$_POST['active'];
$why =$_POST['Q1']
$le =$_POST['Q2']
$skype =$_POST['skype']
if(mysqli_query($conn, "INSERT INTO app (username,job,active,why,le,skype) VALUES ('$user','$job','$active','$why','$le','$skype')"))
echo"successfully inserted";
else
echo "failed";
?>
But when I have it like that I get this error
Parse error: syntax error, unexpected '$le' (T_VARIABLE) in C:\xampp\htdocs\app_insert.php on line 8
Keep in mind I am using xampp with Apache and Mysql, anyone know whats happening?
</div>
You missed out the semi-colon, ;
for:
$why =$_POST['Q1']
$le =$_POST['Q2']
$skype =$_POST['skype']
It should be:
$why =$_POST['Q1'];
$le =$_POST['Q2'];
$skype =$_POST['skype'];
You are missing the semi-colon and the insert SQL statement seems incorrect. You are passing the string to SQL statements instead of the value
<?php
include_once('db.php');
$user =$_POST['username'];
$job =$_POST['job'];
$active =$_POST['active'];
$why =$_POST['Q1'];
$le =$_POST['Q2'];
$skype =$_POST['skype']
if(mysqli_query($conn, "INSERT INTO app (username,job,active,why,le,skype) VALUES ('{$user}','{$job}','{$active}','{$why}','{$le}','{$skype}')"))
echo"successfully inserted";
else
echo "failed";
?>