我的 php 邮件表单在我的邮箱中是空的,由于某种原因它没有收集在 HTML 中输入的文本字段信息。
这是它在我的邮箱中的显示方式:
Email:
First Name:
Last Name:
Phone:
Vehicle:
Engine:
Tickbox Engine:
Tickbox Aerodynamics:
Tickbox Wheels:
Tickbox Suspension:
Tickbox Exhaust:
Tickbox Brakes:
Tickbox Interior:
Message:
这是我的 php 代码:
$firtnameField = $_POST['firstname'];
$lastnameField = $_POST['lastname'];
$phonenameField = $_POST['phone'];
$emailField = $_POST['email'];
$vehicleField = $_POST['vehicle'];
$engineField = $_POST['engine'];
$tickboxengineField = $_POST['infoengine'];
$tickboxaerodynamicsField = $_POST['infoaero'];
$tickboxwheelsField = $_POST['infowheels'];
$tickboxsuspensionField = $_POST['infosuspension'];
$tickboexhaustField = $_POST['infoexhaust'];
$tickboxbrakesField = $_POST['infobrakes'];
$tickboxinteriorField = $_POST['infointerior'];
$tickboxmessageField = $_POST['message'];
$tickboxsendField = $_POST['infosend'];
$body = <<<EOD
<br><hr><br>
Email: $email <br>
First Name: $firstname <br>
Last Name: $lastname <br>
Phone: $phone <br>
Vehicle: $vehicle <br>
Engine: $engine <br>
Tickbox Engine: $infoengine <br>
Tickbox Aerodynamics: $infoaero <br>
Tickbox Wheels: $infowheels <br>
Tickbox Suspension: $infosuspension <br>
Tickbox Exhaust: $infoexhaust <br>
Tickbox Brakes: $infobrakes <br>
Tickbox Interior: $infointerior <br>
Message: $message <br>
EOD;
$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$succes = mail($webMaster, $emailSubject, $body, $headers);
这是我的 HTML:
<form id="form1" name="form1" method="post" action="requestform.php">
<table width="540" border="0" align="center" cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td width="48%" height="30" class="subheadline">First Name</td>
<td width="4%" height="30"> </td>
<td width="48%" height="30" class="subheadline">Last Name</td>
</tr>
<tr>
<td width="48%"><input name="firstname" type="text" id="firstname" size="45" /></td>
<td width="4%"> </td>
<td width="48%"><input name="lastname" type="text" id="lastname" size="45" /></td>
</tr>
<tr valign="bottom">
<td width="48%" height="30" class="subheadline">Phone</td>
<td width="4%" height="30"> </td>
<td width="48%" height="30" class="subheadline">Email</td>
</tr>
<tr>
<td width="48%"><input name="phone" type="text" id="phone" size="45" /></td>
<td width="4%"> </td>
<td width="48%"><input name="email" type="text" id="email" size="45" /></td>
</tr>
<tr valign="bottom">
<td width="48%" height="30" class="subheadline">Vehicle & Model</td>
<td width="4%" height="30"> </td>
<td width="48%" height="30" class="subheadline">Engine</td>
</tr>
<tr>
<td width="48%"><input name="vehicle" type="text" id="vehicle" size="45" /></td>
<td width="4%"> </td>
<td width="48%"><input name="engine" type="text" id="engine" size="45" /></td>
</tr>
<tr valign="bottom">
<td width="48%" height="30" class="subheadline">Please select</td>
<td width="4%" height="30"> </td>
<td width="48%" height="30"> </td>
</tr>
<tr>
<td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="25"><input type="checkbox" name="infoengine" id="infoengine" />
Engine Technology</td>
<td height="25"><input type="checkbox" name="infoaero" id="infoaero" />
Aerodynamics</td>
<td height="25"><input type="checkbox" name="infowheels" id="infowheels" />
Sport Wheels</td>
<td height="25"><input type="checkbox" name="infosuspension" id="infosuspension" />
Suspension</td>
</tr>
<tr>
<td height="25"><input type="checkbox" name="infoexhaust" id="infoexhaust" />
Exhaust Technology</td>
<td height="25"><input type="checkbox" name="infobrakes" id="infobrakes" />Brake Technology</td>
<td height="25"><input type="checkbox" name="infointerior" id="infointerior" />
Interior</td>
<td height="25"> </td>
</tr>
</table></td>
</tr>
<tr valign="bottom">
<td width="48%" height="30" class="subheadline">Message</td>
<td width="4%" height="30"> </td>
<td width="48%" height="30"> </td>
</tr>
<tr>
<td colspan="3"><textarea name="message" id="message" cols="74" rows="5">Please send me information…</textarea></td>
</tr>
<tr valign="bottom">
<td width="48%" height="30"> </td>
<td width="4%" height="30" align="right"> </td>
<td width="48%" height="30" align="right"><input type="submit" name="send" id="send" value="Request Information" /></td>
</tr>
</table>
</form>
我相信您可以看到我离成为专业人士还很遥远,这是我正在尝试的第一个 PHP 邮件表单。观看了教程并尝试将其转换为我的需求……感谢任何输入。