我想为我的网站,学生必须选择3个或更少了约10个选择(多选)创建一个页面。 他们还需要在下面上传该文件。 当他们点击提交最后,它会送他们上传到多个电子邮件地址的文件(甚至是特定的一个电子邮件地址会的工作)的基础上他们的选择(3或更低出10个选项)。
是否有人可以帮助我吗? 我有HTML的一个好知识,但我不知道的JavaScript,因此我有很多的麻烦计算出来。 我已经看过了互联网上的各种帖子,但我无法找到的东西,是非常相似和工作。
此外,我使用WordPress,因为我需要添加JavaScript的网页,我安装了一个名为Exec的-PHP插件插件。 这似乎是它的工作原理,但是请不要让我知道你的意见。
非常感谢,非常感谢所有帮助!
编辑:这是我试过的代码。 它是什么,我发现,当我通过各种岗位看去。 它不正是我在这个问题中提及,因为就像我之前提到的,我没有JavaScript的任何预备知识。 在这里,它基本上应该将消息发送到基于单个下拉选择的电子邮件。 我试了一下,但没有工作(我改变了目的地电子邮件)。 谢谢!
<form id="contactForm" method="post" accept-charset="utf-8">
<input id="name" type="text" name="name" minlength="2" placeholder="Your Name…" required>
<input id="email" type="email" name="email" placeholder="Your Email…" required>
<input id="name2" type="text" name="name2" placeholder="Your Last Name…" required>
<select id="department" type="text" name="department">
<option value="customer" name="customer">I am a customer</option>
<option value="distribution" name="distribution">department in distribution</option>
<option value="press" name="press">I am with the press</option>
<option value="career" name="career">department in a career position</option>
<option value="other" name="other">Other</option>
</select>
<textarea name="message" placeholder="Your Message…" required></textarea>
<input type="submit" value="Send away!">
</form>
<?php
// We use the name2 field as bait for spambots. It's display is off,
// so humans wouldn't know to enter anything into it. Robots would,
// so we ignore submissions with info in name2.
$mail_sent = false;
if(sizeof($_POST) && $_POST["name2"] == "") // receiving a submission
{
define("SUBJECT", "Visitor Message from Website");
// production recipient:
define("RECIPIENT", ".$department.");
// prep our data from the form info
$senderName = $_POST['name'];
$senderEmail = $_POST['email'];
$department = $_POST['department'];
$subject = SUBJECT;
$messageBody = $senderName . ' ('.$senderEmail.') wrote in '.$department.':
' . $_POST['message'];
if($department == 'customer') { //if customer was selected
$to = 'customer@gmail.com';
}
else if($department == 'distribution') { //if distribution was selected
$to = 'distribution@email.com';
}
else if($department == 'press') { //if press was selected
$to = 'press@email.com';
}
else if($department == 'career') { //if career was selected
$to = 'career@email.com';
}
else if($department == 'other') { //if other was selected
$to = 'other@email.com';
}
// From
$header = "from: $senderName <$senderEmail>";
// To
$to = RECIPIENT;
// Send it!
$send_contact = mail($to, $subject, $messageBody, $header);
// Check success of send attempt
if($send_contact){
// show thankyou screen
$mail_sent = true;
}
else {
// send failed.
echo "ERROR";
}
}
?>