<form name="info" class="infom" method="post" action="" onSubmit="return formcheck()">
<label style="position:relative; left:145px;">Name<span class="redstar">*</span></label><input type="text" name="uname" style="position:relative; left:156px;"><br><br>
<label style="position:relative; left:119px;">Company<span class="redstar">*</span></label><input type="text" name="company" style="position:relative; left:131px;"><br><br>
<label style="position:relative; left:142px;">Phone<span class="redstar">*</span></label><input type="text" name="phone" style="position:relative; left:153px;"><br><br>
<label style="position:relative; left:42px;">Message</label><br>
<textarea rows="10" cols="42" style="position:relative; left:42px; width:315px;" name="message"></textarea><br>
<center><input type="submit" value="Send Message" class="submitbtn"></center>
</form>
<?php
$name = isset($_POST['uname'])?$_POST['uname']:"";
$phone = isset($_POST['phone'])?$_POST['phone']:"";
$company = isset($_POST['company'])?$_POST['company']:"";
$message = isset($_POST['message'])?$_POST['message']:"";
$msg = "name:".$name."<br />"."phone:".$phone."<br />"."company:".$company."<br />"."message:".$message;
$to = "[email protected]";
$subject = "Soriana Contact";
$from = $name;
$headers = "From: {$name}";
if(mail($to,$subject,$msg,$headers)){
echo "<script>alert('Thanks for your support')</script>";
}else{
echo "<script>alert('Failed')</script>";
return false;
}
?>
------解决方案--------------------
你这样写没做任务的判断,当然是直接发送出去了