如何在PHP_SELF post方法中获取下拉值

时间:2014-02-01 10:15:45

标签: php forms post

我正在使用以下代码来获取输入文本框的值,它工作正常,但如果我想获得选择框的值,应该是我的代码。 (即)下拉框。

    <form method="post" action="<?php echo $_SERVER[’PHP_SELF’];?>" id="uploadform" enctype="multipart/form-data">
    <table width="100%" border="0" cellspacing="0" cellpadding="8">
    <tr>
      <td><span class="enquiry_text">Name*</span></td>
    </tr>
    <tr>
      <td><input type="text" name="fname" value="<?php $_SESSION['myForm']['fname']; ?>" class="enquiry_width_1" /></td>
    </tr>
    <tr>
      <td><span class="enquiry_text">Post Applied For*</span></td>
    </tr>
    <tr>
      <td><select name="jobopening" class="enquiry_width_1" id="jobopening"  value="<?= $_SESSION['myForm']['jobopening']; ?>" >
          <option value="">Select </option>
          <option value="Site Engineer">Site Engineer</option>
          <option value="Project Engineer">Project Engineer</option>
          <option value="Project Manager">Project Manager</option>
          <option value="Administration">Administration</option>
          <option value="Accountant">Accountant</option>
          <option value="Marketing">Marketing</option>
          <option value="Store Keeper">Store Keeper</option>
          <option value="Other Position">Other Position</option>
        </select></td>
    </tr>
    <tr>
      <td><span class="enquiry_text">Qualification*</span></td>
    </tr>

请告诉我如何获得下拉值。如果我想获得一个选择框的值,我的代码应该是什么。 (即)下拉框。

1 个答案:

答案 0 :(得分:0)