PHP电子邮件联系表单,主题不起作用的下拉框

时间:2013-03-03 17:39:47

标签: php

我有一个联系表单,用于将用户输入值邮寄到电子邮件地址。它工作正常,它发送除了主题之外的所有信息,我将其作为带有一些选择的下拉框呈现。我希望将所选选项设置为电子邮件主题。

<select name="subject">
  <option value="1" selected>1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
</select>


<?php
  $email      = $_POST['email'];
  $message    = $_POST['message'];
  $name       = $_POST['name'];
  $subject    = $_POST['subject'];
  $phone      = $_POST['phone'];
  $to         = 'emailaddress.co.uk';
  $from       = $email;
  $header     = "From:" . $from;
  $msgsubject = "$subject message from $name";
  $commessage = "Name: $name

  Email: $email

  Phone Number: $phone

  Subject: $subject

  Message: $message";

  mail($to, $msgsubject, $commessage, $header);
?>

1 个答案:

答案 0 :(得分:0)

<select name="subject]">

subject]?真的?

(提示:不!)