如何检索表单中的select标签的值(使用PHP)?

时间:2016-06-13 01:11:58

标签: php select

<select class="form-control select-picker" style="width: 334px; border-radius: 5px; background-color: rgba(255, 255, 255, 0.9);" data-style="btn-info">
    <option value="" selected disabled>Please select one URL</option>
    <option value="callboxinc.com">option.com</option>
    <option value="callboxinc.co.uk">option.co.uk</option>
    <option value="callboxinc.com.au">option.com.au</option>
    <option value="callboxinc.com.sg">option.com.sg</option>
    <option value="callboxinc.com.my">option.com.my</option>
    <option value="pointerbiz.com">option.com</option>
    <option value="chartedenergy.com">option.com</option>
    <option value="callbox-inc.com">option-inc.com</option>
    <option value="cbimaketingsolutions.com">option.com</option>
    <option value="greensealgroup.com">option.com</option>
    <option value="tecfinity.net">option.net</option>
    <option value="bpsenterprise.com">option.com</option>
    <option value="finitech.net">option.net</option>
    <option value="finitcorp.net">option.net</option>
</select>

1 个答案:

答案 0 :(得分:2)

为select标记添加名称,将其包含在表单中并将其提交给服务器。

<form method="post" action="process.php">
   <select name="site" ... (rest of your attributes here) ...>
   ... your options ...
   </select>
</form>

process.php

// Display the value of the select statement as passed to PHP
echo $_POST['site'];