Trying to write form info to file. If(isset) writes strings to file but will not write form info to file. It cannot recognise sessions request or Post variables. what can I do? In this code I tried to write the variable $info to file but nothing happens. It writes to screen outside if (isset) just fine.
Code:
<?php
session_start();
include 'Klasser.php';
$Pers = new Kunde();
$Best = new Bestilling();
$Persinfo = $Pers->tilStreng();
$Filminfo = $Best->tilStreng();
$info = $Persinfo . "</br>" . $Filminfo;
$send = $_REQUEST["email"];
echo "Følgende valg er gjort :</br>";
echo $info;
$_SESSION["name_id"] =$_REQUEST["name_id"];
$_SESSION["email"] =$_REQUEST["email"];
$_SESSION["dato"] =$_REQUEST["dato"];
$_SESSION["show"] =$_REQUEST["show"];
?>
</br>
<form action="" method="POST">
Stemmer bestillingen?
<input type="checkbox" value='' name='box' />
<input type="submit" value="Bekreft bestilling" name="knapp" />
</form>
<a href="index.php">Forandre på bestilling</a>
<?php
if (isset($_POST["knapp"])) {
mail($send, "Bekreftelse av Kinobestilling", $info);
echo "<br/>Brekreftelse sendt";
$filref = fopen("Bestilt.txt", "w");
fwrite($filref, "Ny Bestilling<br/>".$info);
fclose($filref);
}
?>
Aucun commentaire:
Enregistrer un commentaire