Form to database, not getting any records
Posted by:
gaute
Date: July 22, 2005 03:23AM
Hi
I am trying to parse a HTML form into a MySQL database.
But when i submit it, no records show up in the database.
It is a simple script so far, just wanted it to get up and running, I'll try to expand it later.
The HTML form is too big to copy in here.
My PHP Script looks like this:
<?
$DBhost = "x";
$DBuser = "x";
$DBpass = "x";
$DBName = "x";
$table = "Evaluering";
mysql_connect($DBhost,$DBuser,$DBpass) or die("Kan ikke koble til databasen");
@mysql_select_db("$DBName") or die("Finner ikke databasen $DBName");
$sqlquery = "INSERT INTO $table
(KundeNr,Navn,Epost,Bedrift,Prosjekt,S1,S2,S3,S4,S5,S6,S7,S8,S9,S10,S11,S12,S13,S14,
Kontakt,Annerledes,KundeAnnerledes,Andre)
VALUES( '$KundeNr',
'$Navn',
'$Epost',
'$Bedrift',
'$Prosjekt',
'$S1',
'$S2',
'$S3',
'$S4',
'$S5',
'$S6',
'$S7',
'$S8',
'$S9',
'$S10',
'$S11',
'$S12',
'$S13',
'$S14',
'$Kontakt',
'$Annerledes',
'$KundeAnnerledes',
'$Andre',
)";
$results = mysql_query($sqlquery);
mysql_close();
print "<HTML><TITLE> PHP and MySQL </TITLE><BODY
BGCOLOR=\"#FFFFFF\"><center><table border=\"0\"
width=\"500\"><tr><td>";
print "<p><font face=\"verdana\" size=\"+0\"> <center>Disse dataene blir registrert:<p><blockquote>";
print "Navn : $Navn<p>
Epost : $Epost<p>
Bedrift : $Bedrift<p>
Prosjekt : $Prosjekt
</blockquote></td></tr></table>
</center></BODY></HTML>";
?>