News:

Tekforums.net - The improved home of Tekforums! :D

Main Menu

PHP Help needed

Started by M3ta7h3ad, March 08, 2007, 19:43:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

M3ta7h3ad

Why on earth is this code not working.


if ($_POST[submitted] == 1) {
//form was submitted
// insert data into database
$insert = mysql_query("insert into students(SID, forename, surname, street, town, locality, postcode, hometel, mobiletel, email, course, coursestart, courseend) values ($_POST[SNo], $_POST[FName], $_POST[SName], $_POST[SAddress], $_POST[Town], $_POST[Locality], $_POST[PostCode], $_POST[HomeTel], $_POST[MobileTel], $_POST[Email], $_POST[Course], $_POST[SDate], $_POST[EDate])")
or die("Could not insert data because ".mysql_error());
echo "
";
echo "Student Created Create Another";
} else {
//form not submitted
?>


Further down the page is:


}
?>


Please help me as my damn page wont return any errors. It just doesnt blimmin work, and gives me a blank white page.

M3ta7h3ad

oh dear god almighty... I cannot believe such a small thing has been holding me back for the last week.

Ill leave it here for you all to try and figure out. Please bear in mind I wasnt seeing an error message, it just didnt work. :D

cornet

Please tell me thats not the code you will be using on a production system.

SQL injections anyone ?

Cornet

cornet

...oh and on first sight the problem is with this line:

 echo "Student Created Create Another";

as you need to escape the quotes around ./index.php

Cornet
 

M3ta7h3ad

Quote from: cornetPlease tell me thats not the code you will be using on a production system.

SQL injections anyone ?

Cornet

rofl... no no. this is just getting on my feet stuff.

Fact of the matter is, itll be on a seperate server in my office, with 4 people who have access to the room let alone the actual software. :) SQL injections are bad, but not primary concern just at the moment.