Putte noget fra session ind i database
Her er min kode:<? session_start(); ?>
<html>
<head>
<title>nix</title>
</head>
<body oncontextmenu="return false"ondragstart="return false"onselectstart="return false">
<div align="left">
<form action="mailto2.php?action=ok" method="POST">
<input type="text" value="Navn" name="name" Style="border:1px solid #000000; background: white"><br>
<input type="text" value="Email" name="email" Style="border:1px solid #000000; background: white"><br>
<input type="text" value="Adresse" name="adress" Style="border:1px solid #000000; background: white"><br>
<input type="text" value="Phone" name="phone" Style="border:1px solid #000000; background: white"><br>
<select name="country">
<option value="01">Option one</option>
<option value="02">Option</option>
<option value="03">Option</option>
<option value="04">Option</option>
<option value="05">Option</option>
<option value="06">Option</option>
<option value="07">Option</option>
<option value="08">Option</option>
<option value="09">Option</option>
<option value="10">Option</option>
<option value="11">Option</option>
<option value="12">Option</option>
</select>
<input type="text" value="Tlf" name="telefon" Style="border:1px solid #000000; background: white"><br>
<p>
<input type="submit" value="Bestellung senden" name="send" Style="border:1px solid #000000; background: white">
<br>
</div>
</form>
<?
include("connect.php");
if($_GET[action] == "ok") {
$message = '';
for($i = 0; $i < sizeof($_SESSION['products']); $i++)
{
$message .= "<html><body><br><br><b>Ordre <br><br></b>";
$message .= "<br><b>Artikelnr: </b>";
$message .= $_SESSION['products'][$i]['prod_id'];
$message .= "<br>";
$message .= "<b>Titel: </b>";
$message .= $_SESSION['products'][$i]['prod_size'];
$message .= "<br>";
$message .= "<b>Pris: </b>";
$message .= $_SESSION['products'][$i]['prod_antal'];
$message .= "<br>";
{
$to = "bratsch@ofir.dk";
//$to
//Mailens modtager
//Email adressen skrives imellem <>
//Kort navn før <>
$navn = $_POST[navn];
$email = $_POST[email];
$adress = $_POST[adresse];
$phone = $_POST[telefon];
$oplysninger = "$navn $email
$adress
$phone
";
$from = "From: Order";
//$to
//Afsender af mailen
//Email adressen skrives imellem <>
//Kort navn før <>
$subject = "Order!"; //Mailens titel
$headers = "MIME-Version: 1.0\r\n";
//$headers
//Standard for mails - optional
//Nødvendigt for, at angive afsenderen.
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; //Angiver at mailens indhold er i HTML-format
$headers .= "$from\r\n"; //Sætter afsender i mailens header
mysql_query("INSERT INTO orders (id, item_nr, name, adress, phone, country, email, dato) VALUES('','".$_SESSION['products']['prod_id']."','$_POST[name]','$_POST[adress]','$_POST[phone]','$_POST[country]','$_POST[email]', now())") or die(mysql_error( ));
}
}
}
?>
</body>
</html>
Hvordan får jeg sat den session ind i databasen?