pinkerton2002
Programmer
My code in the form is this:
<form method= "post" action="process.php">
Navn : <input type= 'text' name= '$navn' > <br><br>
Hjemmeside : <input type= 'text' name= '$hjemmeside' > <br><br>
Comment : <input type= 'text' name= '$kommentar' > <br><br>
<input type= 'submit' value= 'Skriv inn' >
</form>
My code in the process.php is this:
<?php
$navn = $_POST['$navn'];
$hjemmeside = $_POST['$hjemmeside'];
$melding = $_POST['$kommentar'];
$tid = date('D M j');
print ($navn);
print ($hjemmeside);
print ($melding);
print ($tid);
include ("conn.php");
mysql_select_db("elsrudc_bryllup") or die("Klarte ikke å velge databasen");
$sql = "INSERT INTO gjest(navn, hjemmeside, tid, melding) values($navn, $hjemmeside, $tid, $melding)" ;
mysql_query($sql) or die("klarte ikke å legge inn i tabell!");
header("location: gjestebok.php");
I've tested that my variables get their values, but still it will not put it into the table..
The connection to the db is working
The error I get is this:"klarte ikke å legge inn i tabell" Which means couldnt put into table!And is the error from the last DIE
The fields in my DB is like this:
ID-integer, auto_increment
navn-Varchar(35)
hjemmeside-Varchar(35)
tid-Varchar(35)
melding-text
I am very grateful for any answers that can help me with this problem
Thank you in advance
<form method= "post" action="process.php">
Navn : <input type= 'text' name= '$navn' > <br><br>
Hjemmeside : <input type= 'text' name= '$hjemmeside' > <br><br>
Comment : <input type= 'text' name= '$kommentar' > <br><br>
<input type= 'submit' value= 'Skriv inn' >
</form>
My code in the process.php is this:
<?php
$navn = $_POST['$navn'];
$hjemmeside = $_POST['$hjemmeside'];
$melding = $_POST['$kommentar'];
$tid = date('D M j');
print ($navn);
print ($hjemmeside);
print ($melding);
print ($tid);
include ("conn.php");
mysql_select_db("elsrudc_bryllup") or die("Klarte ikke å velge databasen");
$sql = "INSERT INTO gjest(navn, hjemmeside, tid, melding) values($navn, $hjemmeside, $tid, $melding)" ;
mysql_query($sql) or die("klarte ikke å legge inn i tabell!");
header("location: gjestebok.php");
I've tested that my variables get their values, but still it will not put it into the table..
The connection to the db is working
The error I get is this:"klarte ikke å legge inn i tabell" Which means couldnt put into table!And is the error from the last DIE
The fields in my DB is like this:
ID-integer, auto_increment
navn-Varchar(35)
hjemmeside-Varchar(35)
tid-Varchar(35)
melding-text
I am very grateful for any answers that can help me with this problem
Thank you in advance