回显格式的下拉列表(PHP)

时间:2017-12-02 11:38:38

标签: php

我想在回显中放置一个下拉列表,因为我正在使用它来更新数据。这是php的代码

        echo "Staff Name: " . "<input type = 'text' style = 'width: 200px' name ='name' value = '$staff_name' required>";

对于HTML,我知道我需要这样做,但我不知道如何申请php(echo)

<select name="sbranch_no">
<option value="Intelligence">Intelligence</option>
<option value="Investigation">Investigation</option>
<option value="Manpower">Manpower</option>
<option value="Operations">Operations</option>
<option value="Police National Service">Police National Service</option>
<option value="Planning and Organization Development">Planning and Organization Development</option>
<option value="Service Quality">Service Quality</option>
<option value="Support and Technical">Support and Technical</option>
<option value="Training">Training</option>
</select>

1 个答案:

答案 0 :(得分:0)

这是你的意思吗?

<?php
    echo '<select name="sbranch_no">
    <option value="Intelligence">Intelligence</option>
    <option value="Investigation">Investigation</option>
    <option value="Manpower">Manpower</option>
    <option value="Operations">Operations</option>
    <option value="Police National Service">Police National Service</option>
    <option value="Planning and Organization Development">Planning and Organization Development</option>
    <option value="Service Quality">Service Quality</option>
    <option value="Support and Technical">Support and Technical</option>
    <option value="Training">Training</option>
    </select>';

?>

或者

<?php
    $menu='<select name="sbranch_no">
        <option value="Intelligence">Intelligence</option>
        <option value="Investigation">Investigation</option>
        <option value="Manpower">Manpower</option>
        <option value="Operations">Operations</option>
        <option value="Police National Service">Police National Service</option>
        <option value="Planning and Organization Development">Planning and Organization Development</option>
        <option value="Service Quality">Service Quality</option>
        <option value="Support and Technical">Support and Technical</option>
        <option value="Training">Training</option>
        </select>';

    echo "some stuff... $menu ...more stuff";
?>