dongsheng1698 2013-12-13 23:51
浏览 29
已采纳

联系表格php - 来自“选择名称”表单的电子邮件消息

Everything works I think besides of this part of contact form where user selects his answer from "select name". I suspect that I have to change ".clean_string" in php $email_message for something else but i don't know php at all so I have no idea what should it be.

PHP part:

    $email_message .= "Imię i nazwisko: ".clean_string($_POST["imie"])."
";
$email_message .= "Email: ".clean_string($_POST["email"])."
";
$email_message .= "Telefon: ".clean_string($_POST["telefon"])."
";
$email_message .= "Płatność: ".implode(" ", $_POST['platnosc'])."
";
$email_message .= "Miesiąc: ".clean_string(" ", $_POST['miesiac'])."
";
$email_message .= "Dzień: ".clean_string(" ", $_POST['dzien'])."
";
$email_message .= "Poziom: ".clean_string(" ", $_POST['poziom'])."
";

The 3 last ones are "select name" and I have no respons in email about them.

HTML:

    <div id="formphp" class="java">

<form name="htmlform" method="post" action="email.php">
<table width="561">
<tr>
 <td width="212" align="right" valign="top">
  <label for="imie"> </label>
 </td>
 <td width="337" valign="top">
    <input type="text" input size="12" name="imie" placeholder="Imię i 

Nazwisko">
 </td>
</tr>
<tr>
 <td valign="top" align="right">
  <label for="nazwisko"></label>
 </td>
 <td valign="top">
  <input type="text" input size="12" name="telefon" 

placeholder="Telefon">
 </td>
</tr>
<tr>
 <td valign="top" align="right">
  <label for="email"></label>
 </td>
 <td valign="top">
  <input type="text" input size="15" name="email" placeholder="E-mail">
 </td>
 </tr>

<div id="formmiesiac">

<select name="miesiac">
    <option selected="selected">Grudzień</option>
    <option>Styczeń</option>
        <option>Luty</option>
        <option>Marzec</option>
</select>
</div>

<div id="formdzien">

<select name="dzien"> 
    <option selected="selected">1</option>
    <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
        <option>7</option>
        <option>8</option>
        <option>9</option>
        <option>10</option>
        <option>11</option>
        <option>12</option>
        <option>13</option>
        <option>14</option>
        <option>15</option>
        <option>16</option>
        <option>17</option>
        <option>18</option>
        <option>19</option>
        <option>20</option>
        <option>21</option>
        <option>22</option>
        <option>23</option>
        <option>24</option>
        <option>25</option>
        <option>26</option>
        <option>27</option>
        <option>28</option>
        <option>29</option>
        <option>30</option>
        <option>31</option>
</select>
</div>

<div id="formpoziom">

<select name="poziom">
    <option selected="selected">Poziom 1</option>
    <option>Poziom 2</option>
        <option>Poziom 3</option>

</select>
</div>

<div id="formplatnosc">

<input type="checkbox" name="platnosc[]" value="gotowka" 

/>&nbsp;Gotówka<br />

<input type="checkbox" name="platnosc[]" value="voucher" 

/>&nbsp;Voucher<br />

</div>




<tr>
 <td colspan="2" style="text-align:center">
  <center><input type="submit" value="Submit Form"></center>
 </td>
</tr>
</table>
</form>

</div>
  • 写回答

1条回答 默认 最新

  • dongmai6666 2013-12-14 00:10
    关注

    In the first four lines, you pass the submitted data as the first parameter to your clean_string() function. In the last three lines you pass two parameters to clean_string() (the space " " as the first parameter and the submitted data as a second parameter). I think this happened because of copying and pasting the implode() line.

    Try to pass the form data as the first parameter to clean_string():

    $email_message .= "Miesiąc: ".clean_string($_POST['miesiac'])."
    ";
    $email_message .= "Dzień: ".clean_string($_POST['dzien'])."
    ";
    $email_message .= "Poziom: ".clean_string($_POST['poziom'])."
    ";
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP