客户在他的网站上有一个非常大的表单(大约 40 个字段),一旦用户单击提交,就应该将其发送到他的邮箱。
我正在考虑这样做:
<?
$name = $_REQUEST['name'] ;
$lastname = $_REQUEST['lastname'] ;
$address = $_REQUEST['lastname'] ;
$field1 = $_REQUEST['field1'] ;
$field2 = $_REQUEST['field2'] ;
$field39 = $_REQUEST['field39'] ;
....
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: Bob <client@example.com>' . "\r\n";
$headers .= 'From: User <example@user.com>' . "\r\n";
// Mail it
mail("client@example.com", "FORM FROM YOUR WEB!", "Name: $name\r\n LastName: $lastname\r\n Address: $address\r\n
Answer to field 1: $field1 ..... ", $headers);
?>
但由于大约有 40 个字段,我不确定我是否以正确的方式进行操作。有没有更合适的方法来做到这一点?