Tekforums

Chat => Entertainment & Technology => Topic started by: M3ta7h3ad on March 08, 2007, 19:43:50 PM

Title: PHP Help needed
Post by: M3ta7h3ad on March 08, 2007, 19:43:50 PM
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.
Title: Re:PHP Help needed
Post by: M3ta7h3ad on March 08, 2007, 19:53:30 PM
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
Title: PHP Help needed
Post by: cornet on March 11, 2007, 20:18:30 PM
Please tell me thats not the code you will be using on a production system.

SQL injections anyone ?

Cornet
Title: PHP Help needed
Post by: cornet on March 11, 2007, 20:22:31 PM
...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
 
Title: PHP Help needed
Post by: M3ta7h3ad on March 11, 2007, 20:29:35 PM
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.