我只需要一个非常基本/简单的表格来发送电子邮件,但它似乎不起作用,我不知道为什么?我知道代码不是很先进,可能看起来很“丑陋”,但它可以满足我的“需要”
if (isset($_POST['email']))
{
$full_name = $_POST['fullName'];
$phone = $_POST['phoneNumber'];
$adMessage = $_POST['emailMessage'];
//send email
$to = "info@lalalalala.co.uk";
$from = $_POST['emailAddress'];
$subject = $_POST['emailSubject'];
$message = "Full name: " . $full_name . "\n";
$message .= "Phone number: " . $phone . "\n";
$message .= "Email Address: " . $from . "\n";
$message .= "Additional Message: " . $adMessage;
$headers = "From:" . $full_name;
mail($to, $subject, $message, $headers);
}
HTML
<form action='' method='post'>
<fieldset><label id="fullName">Full Name</label>
<input type="text" name="fullName" value="Please Enter Your Full Name" onclick="this.value=''" /></fieldset>
<fieldset><label id="emailAddress">Email Address</label>
<input type="text" name="emailAddress" value="Please Enter Your Email Address" onclick="this.value=''" /></fieldset>
<fieldset><label id="phoneNumber">Phone Number</label>
<input type="text" name="phoneNumber" value="Please Enter Your Phone Number" onclick="this.value=''" /></fieldset>
<fieldset><label id="emailSubject">Email Subject</label>
<input type="text" name="emailSubject" value="Please Enter Email Subject" onclick="this.value=''" /></fieldset>
<fieldset><label id="emailMessage">Your Message</label>
<textarea cols="10" rows="20" name="emailMessage" onclick="this.value=''" >Please Enter Your Message</textarea></fieldset>
<fieldset><input type="image" src="images/submit.png" id="submit" onclick="show_alert();" /></fieldset>
</form>
谢谢 :)