die('Could not connect: ' . mysql_error());
$query="INSERT INTO".data_feedback."(First Name,Last Name,Email,Telephone,Comments)
('". $_POST['firstname']."','". $_POST['lastname']."','". $_POST['email']."',". $_POST['telephone']."','". $_POST['comments']."')"
echo"Feedback is recieved";
echo"There is an error";
Ive got a syntax error on line 17.
This is the part:$data=mysql_query($query);
Im new to php so i cant figure it out,can anyone help
Try a semicolon on the previous line.
But your code is a pretty good example of how not to access a database from a security perspective.
You have to do input validation.
I'd also suggest to not learn to program using the mysql interface anymore (it's obsolete) and use the mysqli one instead (note the i), and prepared statements instead.
This is one of the few times a syntax error was doing you a favor by stopping unfiltered web input from getting to your SQL server.
I agree with Incredibill & Swa66;
But just to clarify, you've got a concatination issue:-
Splitting it like this REALLY highlights your syntax error. And it's just one char too..
I prefer giving a clue to a problem, rather than telling you that you're fundamentally flawed for the third time :)
Now that it's Monday I'll get serious here as there's other issues such as directly accessing the values without testing to see if they were passed:
You need to test variable presence using isset() or empty() first to make sure all the parameters were passed otherwise you'll get errors accessing them in the SQL statement as well.
To add to this, you can sort out ALL of your $_POST vars by passing them through the array_map() - and using it's callback mechanisim will save time and lines of code too.
Then using something like mysql_real_escape_string, strip_tags, trim you can make the data a little safer.