我想为一个网站设置一个简单的PHP联系表单,我需要一些帮助修改PHP以列出选择菜单中的多个项目,并希望得到帮助。我是一名平面设计师,而不是开发人员,所以很多都是我的头脑。这就是问题所在区域位置:以php电子邮件的形式选择多个复选框
HTML:
<form method="post" action="projectplanner.php">
<label>Name*</label><input class="text" name="name" placeholder="Typ hier uw naam">
<label>Email*</label><input class="text" name="email" type="email" placeholder="Typ hier uw email">
<label>Telefoon*</label><input class="text" name="telefoon" type="tel" placeholder="Telefoon of mobiel">
<label>Organisatie*</label><input class="text" name="organisatie" placeholder="Ik vertegenwoordig..">
<label>Bestaande website (indien van toepassing)</label><input class="text" name="website" placeholder="http://www">
<label>Soort project</label>
<input name="project[]" type="checkbox" value="huisstijl" class="check" />Huisstijl<br />
<input name="project[]" type="checkbox" value="websiteontwerp" class="check"/>Website ontwerp<br />
<input name="project[]" type="checkbox" value="websiteontwikkeling" class="check"/>Website ontwikkeling<br />
<input name="project[]" type="checkbox" value="onlinemarketing" class="check-last"/>Online marketing<br />
<label>Beschrijving van uw project</label>
<textarea class="project_text" name="beschrijving" placeholder="Een globale beschrijving. Doelstelling, publiek, concurenten?"></textarea>
<label>Inspiratie</label>
<textarea class="project_text" name="inspiratie" placeholder="Kopieer links naar website/apps/afbeeldingen die u inspireren"></textarea>
<label>* 2+2= ? (Anti-spam)</label>
<input name="human" placeholder="Antwoord">
<input id="submit" name="submit" type="submit" value="Verzend">
PHP:
<?php
$naam = $_POST['naam'];
$email = $_POST['email'];
$telefoon = $_POST['telefoon'];
$organisatie = $_POST['organisatie'];
$website = $_POST['website'];
$beschrijving = $_POST['beschrijving'];
$project = $_POST['project'];
$inspiratie = $_POST['inspiratie'];
$from = 'From: the website';
$to = '[email protected]';
$subject = 'onderwerp';
$human = $_POST['human'];
$body =
"Van: $name\n
E-Mail: $email\n
Telefoon: $telefoon\n
Organisatie: $organisatie\n
Website: $website\n
Project Soort: $project\n
Omschrijving: $beschrijving\n
Inspiratie: $inspiratie";
if ($_POST['submit'] && $human == '4') {
if (mail ($to, $subject, $body, $from)) {
print ("Dank u wel");
/*echo '<p>Uw bericht is verzonden!</p>';*/
} else {
echo '<p>Oeps. Er ging iets fout. Probeer nogmaals.</p>';
}
} else if ($_POST['submit'] && $human != '4') {
/*echo '<p>Uw anti-spam antwoord is niet goed ingevuld.</p>';*/
}
你可以像这个'$ _POST ['project']'那样访问你的复选框,运行'var_dump($ _ POST ['project'])'来看看它包含了什么。 – afuzzyllama