下面的代码是我用来给我电子邮件表单内容的代码。我有两个问题,希望有人能帮忙。
<textarea>,它也不会出现在发送给我的电子邮件中。PHP代码:
<?php
header('Location: thank-you.html');
$from = $_POST['email'];
$to = 'email@example.com';
$subject = "subject";
$message = "";
foreach ($_POST as $k=>$v)
{
if (!empty($message)) { $message .= "\n\n"; }
$message .= ucwords(str_replace('_',' ',$k)).": ".$v;
}
$headers = "From: $from";
mail($to, $subject, $message, $headers);
?>发布于 2011-09-24 05:42:22
您可能有这样的复选框组:
<input type=checkbox name=box value='one'>
<input type=checkbox name=box value='two'>当它们看起来像这样(名字后面有方括号)
<input type=checkbox name=box[] value='one'>
<input type=checkbox name=box[] value='two'>然后,php将将这些值存储在$_POST['box']中的数组中,然后您可以将该数组加入到现有打印代码中带有implode(', ', $_POST['box'])格式的逗号分隔字符串中。
https://stackoverflow.com/questions/7537220
复制相似问题