我如何获得我的“收音机”?按钮显示在我的电子邮件上?

发布于 2024-12-07 06:20:51 字数 8673 浏览 1 评论 0原文

我有一个一直在处理的表单,但我遇到的问题只是单选按钮没有显示在我收到的电子邮件中。我已尝试一切方法来获得正确的代码,但我不知道该怎么做...请帮忙!

这是我的 Visual .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 <[email protected]>' . "\r\n";
$headers .= 'From: Espressions Coffee Roastery Contact Form <[email protected]>' . "\r\n";

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

I have a form that I have been working on and I've been having problems only with the radio buttons not showing up on the emails I receive. I have tried everything to get the right code but I am not sure what to do...PLEASE HELP!

here is my code for the visual .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é/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 & Gridning Equipment">BUNN Commercial Brewing & 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 & 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 /> 

Here is my code for 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 <[email protected]>' . "\r\n";
$headers .= 'From: Espressions Coffee Roastery Contact Form <[email protected]>' . "\r\n";

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情话已封尘 2024-12-14 06:20:51

认为问题出在这里:

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

应该是:

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

您使用了 radio 元素的 id 属性,而不是电子邮件代码中的 name 属性,而您应该只使用您已将其设置在 sendmail.php 脚本的顶部,即 $products$equipment

Think the problem is here:

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

It should be:

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

You've used the id attribute of the radio element and not the name attribute in your email code when you should just use what you have set it to at the top of your sendmail.php script which is $products and $equipment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文