PDA

View Full Version : Help Needed - PHP Form



Rob
23-02-2006, 11:54 AM
Hi,
It's a long time since I've been on HbxF, I've been working on my coding skills (pfft.. What coding skills?) And I've TRIED to make a php form. There's just 1 problem, when I click send it shows this error:

Parse error: parse error, unexpected T_VARIABLE in /home/nitroxd/public_html/send.php on line 11

The PHP code I'm using is:

<?php

$email = "[email protected]"; // The email address that is receiving the order.
$subject = "New Order"; // The subject of the email being sent.
$name = $_POST['name']; // The commenter's name.
$commentemail = $_POST['email']; // The commenter's email address.
$websitename = $_POST['website name']; // Website Name.
$colours = $_POST['website colours']; // Website Colours.
$uploaddir = '/dir/to/upload/to'; // The directory you want the files to be uploaded to (without the ending slash).
$uploadfile = $uploaddir . "/" . basename($_FILES['userfile']['name']); // The full path to the uploaded file.
$uploadurl = "http://www.nitrox-designs.com"; // The url to the upload directory (without the ending slash).
$urlfile = $uploadurl . "/" . $_FILES['userfile']['name'];


if (file_exists($_FILES['userfile']['tmp_name'])) { //If a user actually uploaded a file, then do this

echo '<pre>';
move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile) or die("Error: Could not move the uploaded file to the correct directory."); // Move the uploaded file to the directory specified.
mail("$email", "$subject", "Order From: $name \n\n Email Address: $commentemail \n\n Website Name: $websitename \n\n Website Colours: $colours \n\n Here is the link to the file that user uploaded: $urlfile"); // Mail the name, email, website name, colours, and a link to the file that is now on the server.
echo "File was successfully uploaded.\n<br />Your order and link to the file you uploaded was sent.";
echo '</pre>';

} else { // If not, just mail everything else.

mail("$email", "$subject", "Order From : $name \n\n Email Address: $commentemail \n\n Website Name: $websitename \n\n Website Colours: $colours \n\n ");
echo '<pre>Thank you. Your order has been sent.</pre>';

}

?>

Could someone please help? I know I'm a n00b at PHP, that's why I got this wrong.

Many Thanks,
Rob

Want to hide these adverts? Register an account for free!