以下係個php檔
”☞☞☞”指住ge係line 46
<?php ob_start(); ?>
<?php
date_default_timezone_set('Asia/Hong_Kong');
ini_set("sendmail_from","sales@*********.com");
ini_set("SMTP","smtp.wtt-mail.com");
/* Set e-mail recipient */
$myemail = "sales@*********.com";
/* Check all form inputs using check_input function */
$company = check_input($_POST['company'], "Please enter your company's name");
$person = check_input($_POST['person'], "Please enter your name");
$tel = check_input($_POST['tel'], "Please enter your contact number");
$email = check_input($_POST['email'], "Please enter your E-mail");
$subject = "Online Enquiry";
/*$contant = check_input($_POST['content'], "Write your comments");*/
/* If e-mail is not valid show error message */
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
{
show_error("E-mail address not valid");
}
/* If URL is not valid set $website to empty */
if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i", $website))
{
$website = '';
}
/* Let's prepare the message for the e-mail */
$message = "Hello!
CTC-940 contact form has been submitted by:
Company Name: $company
Contact Person: $person
Tel: $tel
E-mail: $email
Content:
$comments
End of message
";
/* Send the message using mail() function */
mail($myemail, $subject, $message);
/* Redirect visitor to the thank you page */
/* Location: http://www.******.com/ */
☞☞☞header('ThankYou.htm');
ob_end_flush();
exit();
更新1:
function check_input($data, $problem='') { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); if ($problem && strlen($data) == 0) { show_error($problem); } return $data; }
更新2:
function show_error($myError) { ?> Order form error
更新3:
Order form error
更新4:
仲有function show error同error page...太長放唔到...><有需要我再試吓放出泥...