如何让我的“收音机”按钮显示在我的电子邮件中?

时间:2011-09-29 01:03:07

标签: php post sendmail

我有一张我一直在处理的表单,我一直遇到问题,只有收到的电子邮件上没有显示单选按钮。我已经尝试了一切来获得正确的代码,但我不知道该怎么办......请帮助!

这是我的视觉.php的代码:

<p style="color: #e40001;">* Denotes required field.</p>

        <p><strong>General Information:</strong></p>

  <form method="post" name="commentForm" action="sendmail.php">
    <p>Your Name: <font size="2" color="#e40001">*</font>
    <input type="text" name="name" value="" size="20" class="required" />
    </p>

    <br />
    <p>Your Title:
    <input type="text" name="title" value="" size="20" />
    </p>

    <p>Company: <font size="2" color="#e40001">*</font>
    <input type="text" name="company" value="" size="20" class="required" />
    </p>

    <p>Email: <font size="2" color="#e40001">*</font>
    <input type="text" name="email" value="" size="20" class="required" />
    </p>

    <p>Website:
    <input type="text" name="website" value="" size="20" />
    </p>  

    <p>Address:
    <input type="text" name="address" value="" size="20" />
    </p>

    <p>City:
    <input type="text" name="city" value="" size="20" />
    </p>

    <p>State/Provice: <font size="2" color="#e40001">*</font>
    <input type="text" name="State" value="" size="20" class="required" />
    </p>

    <p>Zip Code: <font size="2" color="#e40001">*</font>
    <input type="text" name="zip" value="" size="20" class="required" />
    </p>  

    <p>Phone: <font size="2" color="#e40001">*</font>
    <input type="text" name="phone" value="" size="20" class="required" />
    </p> 

    <p>Fax:
    <input type="text" name="fax" value="" size="20" />
    </p><br /><br />                           

    <p><strong>Professional Information:</strong></p>

        <p>Type of business?
<SELECT name="operation"><option>--Select Operation--
    <option>---------------------
    <OPTION value=cafe/bar>Caf&eacute;/coffee bar
    <OPTION value=restaurant>Restaurant/Bar
    <OPTION value=kiosk>Kiosk
    <OPTION value=hotel>Hotel/Motel
    <OPTION value=university>University
    <OPTION value=hospital>Hospital
    <OPTION value=grocer/market>Grocer/Market
    <OPTION value=other>Other
    </select></p> 

    <p>If other, please desribe:
    <input type="text" name="other" value="" size="20" />
    </p><br /><br />        

    <p>Is this a new business?
    <input type="radio" name="newsletter-yes" id="radio" value="No" title="Check No if you would not like our newsletter" />New
    <input type="radio" name="newsletter-no" id="radio2" value="Yes" title="Check Yes if you would like our newsletter" />Existing</p>

    <p>I am interested in learning more about the following equipment:<br />
    <input type="radio" name="equipment" id="radio" value="BUNN Commercial Brewing &amp; Gridning Equipment">BUNN Commercial Brewing &amp; Gridning Equipment <br />
    <input type="radio" name="equipment" id="radio" value="La Marzocco Traditional Espresso Machines">La Marzocco Traditional Espresso Machines<br />
    <input type="radio" name="equipment" id="radio" value="Rancilio Traditional Espresso Machines">Rancilio Traditional Espresso Machines <br />
    <input type="radio" name="equipment" id="radio" value="Egro Superautomatic Espresso Machines">Egro Superautomatic Espresso Machines <br />        
    <input type="radio" name="equipment" id="radio" value="Mazzer/Swift Espresso Grinders/Dosers">Mazzer/Swift Espresso Grinders/Dosers<br />
    <input type="radio" name="equipment" id="radio" value="Blendtec Blenders">Blendtec Blenders <br />        
    </p>


    <p>I am interested in learning more about the following products:<br />
    <input type="radio" name="products" id="radio1" value="" title="" />Espressions Coffees/Teas<br />
    <input type="radio" name="products" id="radio1" value="" title="" />Monin All-Natural Syrups, Sauces &amp; Frappes <br />
    <input type="radio" name="products" id="radio1" value="" title="" />Big Train Frozen Drink Bases<br />
    <input type="radio" name="products" id="radio1" value="" title="" />Pacific Natural Foods Soy/Vanilla Soy, Smoothie Bases, Almond Milk<br />        
    <input type="radio" name="products" id="radio1" value="" title="" />Two Leaves and a Bud Tea Sachets<br />
    <input type="radio" name="products" id="radio1" value="" title="" />Umpqua Oats<br />
    </p>     

    <p>I am interested in learning more about your barista training program:
    <input type="radio" name="barista training no" id="radio" value="No" title="Check No if you are not interested" />No
    <input type="radio" name="barista training yes" id="radio2" value="Yes" title="Check Yes if you are interested" />Yes</p>  

    <p>Questions/ Comments:
    <input type="text" name="other2" value="" size="40" />
    </p>

    <p><input type="submit" value="Send" />

    <input type="reset" value="Reset" /></p>

  </form><br /><br /> 

这是我的sendmail.php代码:

// values from POST data
$name = $_POST['name'];
$title = $_POST['title'];
$company = $_POST['company'];
$email = $_POST['email'];
$website = $_POST['website'];
$address = $_POST['address'];
$city = $_POST['city'];
$State = $_POST['State'];
$zip = $_POST['zip'];
$equipment = $_POST['equipment'];
$products = $_POST['products'];
$phone = $_POST['phone'];
$fax = $_POST['fax'];
$operation = $_POST['operation'];
$other = $_POST['other'];
$newsletter = $_POST['newsletter'];
$click1 = $_POST['click1'];
$click2 = $_POST['click2'];
$click3 = $_POST['click3'];
$click4 = $_POST['click4'];
$click5 = $_POST['click5'];
$click6 = $_POST['click6'];
$push1 = $_POST['push1'];
$push2 = $_POST['push2'];
$push3 = $_POST['push3'];
$push4 = $_POST['push4'];
$push5 = $_POST['push5'];
$push6 = $_POST['push6'];



// subject
$subject = 'Espressions Coffee Roastery Contact Form';

// message
$message = '
<html>
<head>
  <title>Espressions Coffee Roastery Contact Form</title>
</head>
<body>
  <p>Name: '.$name.'</p>
  <p>Title: '.$title.'</p>
  <p>Company: '.$company.'</p>
  <p>Email: '.$email.'</p>
  <p>Website: '.$website.'</p>
  <p>Address: '.$address.'</p>
  <p>city: '.$city.'</p>
  <p>State: '.$State.'</p>
  <p>Zip Code: '.$zip.'</p>
  <p>Phone: '.$phone.'</p>
  <p>Fax: '.$fax.'</p>
  <p>Operation: '.$operation.'</p>
  <p>Other: '.$other.'</p>
  <p>Newsletter: '.$newsletter.'</p>
  <p>questions: '.$other2.'</p>
  <p>BUNN Commercial: '.$click1.'</p>
  <p>La Marzocco: '.$click1.'</p>
  <p>Ranchilio Traditional: '.$click1.'</p>
  <p>Egro Superautomatic: '.$click1.'</p>
  <p>Mazzer/ Swift Espresso: '.$click1.'</p>
  <p>Blendtec Blenders: '.$click1.'</p>
  <p>Espressions: '.$push1.'</p>
  <p>Monin All-Natural: '.$push1.'</p>
  <p>Big Train Frozen Drink: '.$push1.'</p>
  <p>Pacific Natural Foods: '.$push1.'</p>
  <p>Two Leaves and a Bud: '.$push1.'</p>
  <p>interested in products: '.$radio.'</p>
  <p>interested in services: '.$radio1.'</p>





</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: Espressions Coffee Roastery <max@estudioray.com>' . "\r\n";
$headers .= 'From: Espressions Coffee Roastery Contact Form <max@estudioray.com>' . "\r\n";

// Mail it
mail($to, $subject, $message, $headers);

1 个答案:

答案 0 :(得分:0)

认为问题出在这里:

<p>interested in products: '.$radio.'</p>
<p>interested in services: '.$radio1.'</p>

应该是:

<p>interested in products: '.$products.'</p>
<p>interested in services: '.$equipment.'</p>

您在电子邮件代码中使用了id属性而不是name属性,只需在sendmail.php的顶部使用您设置的内容即可脚本为$products$equipment