选择选项值是填充取决于用户在php中给出的文本框值

时间:2017-04-28 05:20:25

标签: php html textbox dropdown

我可以设计网站。它有文本框输入和选择输入类型。我需要填充选择选项值取决于用户输入值。我可以吗? 提前谢谢!

<input type="text" name="name">

    <?php if(isset($_POST['name'])=="abcd"){$cir="1";} 
      elseif(isset($_POST['name'])=="efgh"){$cir="2";} 
      elseif(isset($_POST['name'])=="ijkl"){$cir="3";} ?>

    <label>Select Circle:</label>
           <select id="cir" name="cir">
    <option value="1" <?php if(isset($_POST['cir'])&&$_POST['cir']=="1")
 {echo 'selected="selected"';}?>>tamil</option>
    <option value="2" <?php if(isset($_POST['cir'])&&$_POST['cir']=="2")
 {echo 'selected="selected"';}?>>english</option>
    <option value="3" <?php if(isset($_POST['cir'])&&$_POST['cir']=="3")
 {echo 'selected="selected"';}?>>hindi</option>

0 个答案:

没有答案