php array

2012-11-21 8:24 pm
如何修改以下$_POST[inquiry]能列出array的值 ,其他行不用修改。

<?php
$message = "
公司名稱: $_POST[company]
公司網站: $_POST[website]
聯絡人: $_POST[name]
聯絡電話: $_POST[contact]
電郵地址: $_POST[email]
查詢類別: $_POST[inquiry]
備註: $_POST[remark]
?>

<label>
<input type="checkbox" name="inquiry[]" value="留言" />留言</label>
<label>
<input type="checkbox" name="inquiry[]" value="詢問" />詢問</label>
<label>
<input type="checkbox" name="inquiry[]" value="客服" />客服</label>
<label>
<input type="checkbox" name="inquiry[]" value="報價"/>報價</label>

回答 (1)

2012-11-22 7:58 pm
✔ 最佳答案
列出array的值?

i think you mean you want drop box/list?

查詢類別:
<select name="inquiry[]" size="4">
<option value="留言">留言</option>
<option value="詢問">詢問</option>
<option value="客服">客服</option>
<option value="報價">報價</option>
</select>

2012-11-22 19:33:50 補充:
e.g after submit

echo "Selected: " " ";
foreach ($_POST[inquiry] as $p){
echo $p;
}

列出對方的所有選擇 at loop place....
echo $p should have what you want....

2012-11-24 04:13:46 補充:
e.g after submit

echo "Selected: " " ";
foreach ($_POST[inquiry] as $p){
echo $p;
}

列出對方的所有選擇 at loop place....
echo $p should have what you want....
how does your post method works?


收錄日期: 2021-04-13 19:07:35
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20121121000051KK00113

檢視 Wayback Machine 備份