简体   繁体   English

使用php从下拉列表中选择表格

[英]Selecting table from drop down list using php

Hey guys just wondering how i go about using a drop down list to show different php tables? 大家好,我只是想知道如何使用下拉列表显示不同的php表? The divs are currently set to hidden but when i do select a table from drop down list and press submit i want it to come up ( div is called fixtures )... please help 当前将divs设置为隐藏,但是当我从下拉列表中选择一个表并按Submit时,我希望它出现(div称为Fixtures)...请帮助

<?php if(isset($_POST["submit"])) {


  if($_POST['chooseoptions'] =='form2') {
  // show fixtures table
  }
  elseif($_POST['chooseoptions'] == 'form3') {
  // change current round number
  }
 elseif($_POST['chooseoptions'] == 'form4') {
 // update user tips
 }
 elseif($_POST['chooseoptions'] == 'form5') {
// reset
} 
 } ?>

<html>
<body>

<form name="work" id="work"  action="POSTBACK" >

<input type="submit" name="submit" value="submit">

<p>Select Table:
<select name="chooseoptions" id="chooseoptions" >
<option value="blank"> </option>
    <option value="form2">Form 2 : Display tip table</option>
<option value="form3">Form 3 : Change rounds</option>
<option value="form4">Form 4 : Update table/option>
<option value="form5">Form 5 : RESET</option>
</select></p>

<div id="fixtures" name="fixtures" style='display: none'>
</div
</body>
</html>

See example below: Evaluate with PHP and print based on the result. 请参见以下示例:使用PHP进行评估并根据结果进行打印。

Adding the class will probably help. 添加类可能会有所帮助。 On clientside you can control the div with using css. 在客户端,您可以使用CSS控制div。 In the example you can use the classes for enabled once: 在示例中,您可以一次使用启用的类:

.fix-enable{} 

and for the disabled one 和为残疾人

.fix-disable{
    //for example disabled
    display:none;
}


    <html>
    <body>

    <form name="work" id="work"  action="POSTBACK" >

        <input type="submit" name="submit" value="submit">

        <p>Select Table:
        <select name="chooseoptions" id="chooseoptions" >
            <option value="blank"> </option>
            <option value="form2">Form 2 : Display tip table</option>
            <option value="form3">Form 3 : Change rounds</option>
            <option value="form4">Form 4 : Update table/option>
            <option value="form5">Form 5 : RESET</option>
        </select>
        </p>
    </form>
    <?php 
    $classname = "fix-disable";
    if(!isset($_POST["submit"])) {
        $classname = "fix-enable";
    }?>
    <div id="fixtures" name="fixtures" class=<?=$classname?>>

    </div>
    </body>
    </html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从下拉列表中选择一个值将更改下一个下拉列表 - Selecting a value from drop down changes the next drop down list 使用javascript在下拉列表中选择一个值 - Selecting a value in drop down list using javascript 如何通过选择使用PHP中的javascript从SQL填充的下拉列表来从SQL检索值到文本区域 - how to retrieve values from SQL into text area via selecting drop down list populated from SQL using javascript in php 使用Angular.js从下拉列表中选择后无法获取值 - Can not get the value after selecting from drop down list using Angular.js 使用下拉列表一次选择一个图表 - Selecting one chart at a time using drop down list 从下拉列表中选择一个值后,MVC重新加载页面 - MVC reload page after selecting a value from the drop down list 从下拉列表中选择数据库生成的值? - Selecting database generated value from a drop-down list? 从下拉列表中选择项目后如何自定义界面? - How to customize the interface after selecting an item from a drop down list? 从下拉列表中选择选项时显示图像 - Displaying an image when selecting an option from a drop down list 从下拉列表中选择选项时反应警告 - React warning when selecting an option from a drop down list
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM