opdatering af database
hejJeg er ny i databaser og PHP/MySQL.
jeg har lavet to php filer, som skulle skrive til en database MySQL, men det gør de af en eller anden grund ikke, og hvorfor kan i måske svare på. her er filerne :
den første hedder "opdatering.php" og skriver til databasen "registrering" med tabellen "kunde" :
<?php
$db = mysql_connect("localhost","root");
mysql_select_db("registrering",$db);
$sql="INSERT INTO kunde(brugernavn,PASSWORD,land,fornavn,eftnavn,adresse,postnr,by,tlf,email)
VALUES('$_POST[brugernavn]','$_POST[PASSWORDl]','$_POST[land]','$_POST[fornavn]','$_POST[eftnavn]','$_POST[adresse]','$_POST[postnr]','$_POST[by]','$_POST[tlf]','$_POST[email]')";
$result = mysql_query($sql);
mail("mhj@privat.tdcadsl.dk","Nyt indlæg i gæstebogen fra ".$_POST[navn],$_POST[besked],"From: ".$_POST[email]);
?>
<html>
<title>Opdater</title>
<body bgcolor="#FFFFFF">
Du er nu blevet tilmeldt og kan herefterlogge ind og handle. <a href="laes.php">Klik for at vende tilbage til forsiden</a>
</body>
</html>
Den anden hedder emailform1.php og den laver en form som man kan udfylde, og når der trykkes submit sendes det til "opdatering.php" :
<HTML>
<HEAD>
<TITLE>Registrering </TITLE>
</HEAD>
<BODY BGCOLOR="#ffffff">
håber i kan hjælpe !!
<?php
?>
<FORM ACTION="opdatering.php" METHOD="POST">
<P><CENTER><TABLE BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" BGCOLOR="#004080">
<TABLE WIDTH="394" BORDER="0" CELLSPACING="1" CELLPADDING="2">
<TR>
<TD COLSPAN="2" BGCOLOR="#004080">
<B><FONT COLOR="#ffffff" SIZE="-1" FACE="Verdana">Bliv tilmeldt </FONT></B></TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Fornavn:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="fornavn" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Efternavn:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="eftnavn" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Adresse:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="adresse" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Post nr.:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="postnr" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">By:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="by" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Land:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="land" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Telefon nr.:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="tlf" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Email:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="email" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Brugernavn:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="brugernavn" TYPE="text" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Password:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="password" TYPE="PASSWORD" SIZE="25">
</TD>
</TR>
<TR>
<TD WIDTH="48%" BGCOLOR="#ffffff">
<B><FONT COLOR="#000000" SIZE="-1" FACE="Verdana">Gentag Password:</FONT></B></TD>
<TD WIDTH="52%" BGCOLOR="#ffffff">
<INPUT NAME="password" TYPE="PASSWORD" SIZE="25">
</TD>
</TR>
</TABLE></CENTER></P>
<P><CENTER><INPUT NAME="submitform" TYPE="submit" VALUE="Submit"></CENTER></FORM></P>
<P><CENTER> </CENTER></P>
</BODY></HTML>
<?php
exit();
?>
