【问题标题】:Simple form mistake [closed]简单的表格错误[关闭]
【发布时间】:2014-06-27 03:10:22
【问题描述】:

我有这个表格应该带我到 online-payment.php 但带有 GET 值,但是当我点击提交时我进入了在线 php 但有了这个链接,我似乎不知道为什么:/

http://localhost/ereserve/online-payment.php?

如您所见,之后什么都没有?因此获取值未在 URL 中编码。

我不知道我的错误在哪里

所有项目都显示,因此查询和 php 正在工作。

只是不对网址进行编码

  <form method="GET" action="./online-payment" >
                    <p style="margin-top:150px;margin-left:100px;">Available Time:</p>
                    <select style="clear:both; width:300px;margin-left:100px;">
                <option></option>

                <?php
                     $b= "SELECT * FROM timeslots,tables Where tables.rid != 'reservation.rid' AND 'tables.tid' != 'reservation.tid' AND 'timeslots.tid' != 'reservation.timeid' ORDER BY timeslotid;"; 
                     $query = mysql_query($b);
                     while ($c= mysql_fetch_row($query))
                     {
                         $timeslotid=$c[0];

                         $timeframe=$c[1];
                         $tid = $c[2];
                         $size=$c[3];
                         $number=$c[4];

                 ?>                                             

                        <option value="<?php echo $timeslotid?>" >
                            <?php echo $timeframe; ?>
                        </option>

                                    <?php  }  ?> 

                    </select>



                    <p style="margin-left:100px;">Table Size:</p>

                        <select style="clear:both; width:300px;margin-left:100px;">
                <option></option>

                <?php
                     $b= "SELECT DISTINCT size FROM timeslots,tables Where tables.rid != 'reservation.rid' AND 'tables.tid' != 'reservation.tid' AND 'timeslots.tid' != 'reservation.timeid' ORDER BY timeslotid;"; 
                     $query = mysql_query($b);
                     while ($c= mysql_fetch_row($query))
                     {
                         $size=$c[0];
                 ?>                                             

                        <option value="<?php echo $size?>">
                            <?php echo $size; ?>
                        </option>

                                    <?php  }  ?> 

                    </select>



                        <p style="margin-left:100px;">Purpose</p>
                        <select style="clear:both; width:300px;margin-left:100px;">
                            <option></option>
                            <option value="No">No Special Purpose</option>
                            <option value="birthday">Birthday</option>
                            <option value="meeting">Meeting</option>
                        </select>


                        <div class="rmenu">

                                    <?php 
                                    $b= "Select * from menuitem where mid=(Select menuid from menu where rid= $rid)"; 
                     $query = mysql_query($b);
                     while ($c= mysql_fetch_row($query))
                     {
                         $id=$c[0];

                         $name=$c[1];
                         $category = $c[2];
                         $price=$c[3];
                         $pic=$c[4];
                         $description=$c[5];

                 ?>          
                                        <div class="menuitem">
                                            <img src="<?php echo $pic; ?> " />
                                             <p><strong> Name: </strong> <?php echo $name ?> </p>
                                            <p><strong> Category: </strong><?php echo $category ?> </p>
                                            <p><strong> Price: </strong> <?php echo $price ?> $</p>
                                            <p><strong> Description: </strong> <?php echo $description ?> </p>
                                            Add to Order : <input type="checkbox" value="<?php echo $id ?>" >
                                        </div>
                                             <?php } ?>
                         </div>
                          <input type="submit" value="Submit" style="width:100px;margin-left:100px;height:50px;float:left;" />    
             </form>

【问题讨论】:

  • 您的输入没有任何name 属性,这意味着它们没有在$_GET 数组中设置。

标签: php html css


【解决方案1】:

在您的元素上添加name 属性,而不仅仅是value 属性。

【讨论】:

  • 谢谢你解决了它:D
【解决方案2】:

可以这么简单吗

<form method="GET" action="./online-payment" > 

更新阅读

  <form method="GET" action="./online-payment.php" >

【讨论】:

    【解决方案3】:

    试过这个。

    <form action="test">
        <input type="text" value="" name="somename" />
        <input type="submit" value="submit" name="test" />
     </form>
    

    这导致了这种网址

    http://localhost/directory/test?somename=value&test=
    

    如果你没有提到表单方法,默认情况下表单方法将是 GET 本身。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-05
      • 2013-12-28
      • 2012-06-07
      • 1970-01-01
      • 1970-01-01
      • 2021-10-04
      • 1970-01-01
      相关资源
      最近更新 更多