i have made a website for my a-level coursework, its ment to be a booking system where the public can submit the dates they want to rent out an apartment. Now the contact us form is written in php, it basically takes what information you enter and puts it into a text file wich is specified in the script, but somewere along the script there is an error because it stopped writing to the txt file but it doesnt give me an error saying it didnt work it redirects me to the page i chose after someone submits a form. the script is as follows...
<?php
if ($_POST['submit'] == "Submit") {
$dir = 'inbox/';
$filename = "booking.txt";
$content .= $_POST['firstname']." ";
$content .= $_POST['lastname']." /n/r E-Mail: ";
$content .= $_POST['email']." /n/r Phone: ";
$content .= $_POST['phone']." /n/r Holliday Dates: ";
$content .= $_POST['fromday']."/";
$content .= $_POST['frommonth']."/";
$content .= $_POST['fromyear']." to ";
$content .= $_POST['today']."/";
$content .= $_POST['tomonth']."/";
$content .= $_POST['toyear']." /n/r Number of People: ";
$content .= $_POST['number']." /n/r Comments: ";
$content .= $_POST['comment']."/n/r <===========================================> nr Name: ";
if (!$error) {
header("Location: pages/thankyou.html"); //change this to redirect to where u want it to
}
}
if (!fwrite($handle, $content)) {
echo 'Cannot write to file: ' . $filename;
exit;
}
?>
i dont know where to begin, i havent got much knowlage of php so i would be more than gratefull if someone can correct it and post it.
p.s. i have checked chmod file permission and set them to 777,
thanks in advanced, i apprechiate any help
johnathan
<?php
if ($_POST['submit'] == "Submit") {
$dir = 'inbox/';
$filename = "booking.txt";
$content .= $_POST['firstname']." ";
$content .= $_POST['lastname']." /n/r E-Mail: ";
$content .= $_POST['email']." /n/r Phone: ";
$content .= $_POST['phone']." /n/r Holliday Dates: ";
$content .= $_POST['fromday']."/";
$content .= $_POST['frommonth']."/";
$content .= $_POST['fromyear']." to ";
$content .= $_POST['today']."/";
$content .= $_POST['tomonth']."/";
$content .= $_POST['toyear']." /n/r Number of People: ";
$content .= $_POST['number']." /n/r Comments: ";
$content .= $_POST['comment']."/n/r <===========================================> nr Name: ";
if (!$error) {
header("Location: pages/thankyou.html"); //change this to redirect to where u want it to
}
}
if (!fwrite($handle, $content)) {
echo 'Cannot write to file: ' . $filename;
exit;
}
?>
i dont know where to begin, i havent got much knowlage of php so i would be more than gratefull if someone can correct it and post it.
p.s. i have checked chmod file permission and set them to 777,
thanks in advanced, i apprechiate any help
johnathan