自动提交或自动刷新下拉列表

时间:2017-06-28 03:31:26

标签: javascript php html

我想自动提交或自动刷新我还不确定,因为我有点困惑。

我有三个下拉列表。我们从数据库中选择前两个下拉列表从数据库中选择团队A和团队B,第三个下拉列表是显示团队A和团队B - 这是我失去它的地方。当我不提交表格时如何查看?

这是我的html代码。

<form action="addmatch.php" method="post" >
                            <div class="match-form" >
                                <div class="match-row">
                                    <label>
                                        <a>Date</a>
                                        <input type="date" name="matchdate" style="margin-left:-8px;" required>
                                    </label>
                                </div>
                                <div class="match-row">
                                    <label>
                                         <a>Time</a>
                                        <input type="time" name="matchtime" style="margin-left:-8px;" required>
                                    </label>
                                </div>
                                <div class="match-row">
                                     <label>
                                            <a>Category</a>
                                            <select name="category" size="1" style="margin-left:-30px;" required>
                                            <option>select</option>
                                            <?php 
                                            if($stmt=$conn->query("select * from categorymatch"))
                                            { while($r=$stmt->fetch_array(MYSQLI_ASSOC))
                                                { ?>
                                            <option value=<?php echo $r['categoryId'] ?>><?php echo $r['categoryName'] ?></option>
                                            <?php } } ?>

                                            </select>

                                    </label>
                                </div>
                                <div class="match-row">
                                <label>
                                            <a>Team A </a>
                                            <select name="teamA" size="1" style="margin-left:-24px;" onchange="submit"   required>
                                            <option>select</option>
                                                <?php 
                                            if($stm=$conn->query("select TEAMLISTID, TEAMLISTNAME from teamlist"))
                                            { while($s=$stm->fetch_array(MYSQLI_ASSOC))
                                                { ?>
                                            <option value=<?php echo $s['TEAMLISTID'] ?>><?php echo $s['TEAMLISTNAME'] ?></option>
                                            <?php } } ?>                                                
                                            </select>
                                    </label>

                                </div>
                                <div class="match-row">
                                <label>
                                            <a>Team B </a>
                                            <select name="teamB" size="1" style="margin-left:-24px;" onchange="submit" required>
                                            <option>select</option>
                                                <?php 
                                            if($stm=$conn->query("select TEAMLISTID, TEAMLISTNAME from teamlist"))
                                            { while($s=$stm->fetch_array(MYSQLI_ASSOC))
                                                { ?>
                                            <option value=<?php echo $s['TEAMLISTID'] ?>><?php echo $s['TEAMLISTNAME'] ?></option>
                                            <?php } } ?>                                                
                                            </select>
                                    </label>

                                </div>
                                <div class="match-row">
                                <label>
                                            <a>Handicap </a>
                                            <select name="handicap" size="1" style="margin-left:-33px;"  required>
                                            <option>select</option>
                                                <option>1:0</option> 
                                                <option>3/4:0</option> 
                                                <option>1/2:0</option> 
                                                <option>1/4:0</option> 
                                                <option>0:0</option> 
                                                <option>0:1/4</option> 
                                                <option>0:1/2</option> 
                                                <option>0:3/4</option> 
                                            </select>
                                    </label>

                                </div>
                                <div class="match-row">
                                <label>
                                            <a>Status Match </a>
                                            <select name="statusmatch" size="1" style="margin-left:-57px;" required>
                                            <option>select</option>
                                                <?php 
                                            if($st=$conn->query("select * from statusmatch"))
                                            { while($a=$st->fetch_array(MYSQLI_ASSOC))
                                                { ?>
                                            <option value=<?php echo $a['statusmatchId'] ?>><?php echo $a['statusmatchName'] ?></option>
                                            <?php } } ?>                                            
                                            </select>
                                    </label>

                                </div>
                                <div class="match-row">
                                <label>
                                            <a>Tip Type </a>
                                            <select name="tiptype" size="1" style="margin-left:-30px;" required>
                                            <option>select</option>
                                                <?php 
                                            if($stt=$conn->query("select * from tiptype"))
                                            { while($b=$stt->fetch_array(MYSQLI_ASSOC))
                                                { ?>
                                            <option value=<?php echo $b['tiptypeId'] ?>><?php echo $b['tiptypeName'] ?></option>
                                            <?php } } ?>                                            
                                            </select>
                                    </label>

                                </div>
                                <div class="match-row">
                                 <label>
                                            <a>Tip </a>
                                            <select name="tip" size="1" required>
                                            <option>select</option>
                                                <?php 
                                            if($stm=$conn->query("select teamA, teamb from matchlist"))
                                            {  ?>
                                            <option value=<?php ?>><?php echo $s['teamA'] ?></option>
                                            <option value=<?php ?>><?php echo $s['teamb'] ?></option>
                                            <?php  } ?>                                             
                                            </select>
                                    </label>
                                </div>
                                <div class="match-row">
                                      <label>
                                        <a>Score </a>
                                        <input type="text" name="scoreteam" style="margin-left:-15px;">
                                    </label>
                                </div>

                                <div class="match-row">
                                  <label>
                                            <a>Result </a>
                                            <select name="result" size="1" style="margin-left:-19px;">
                                            <option>select</option>
                                                <option>Win</option> 
                                                <option>Loss</option> 
                                                <option>Draw</option>                                               
                                            </select>
                                    </label>
                                </div>

                                <input type="submit" id="someText" value="Submit" style="margin-left:200px; margin-top:30px; margin-bottom:20px; padding:10px;">
                            </div>
                        </form>
你可以帮我解决问题吗?

谢谢!

0 个答案:

没有答案