duanneng2014 2013-07-28 11:33
浏览 14
已采纳

404找不到$ _Server ['PHP_SELF']

I made a connection with a database to send a form to the data base but when I use my submit-button it says:"Not Found

The requested URL /php/GIP/' $_SERVER['PHP_SELF'] ' was not found on this server."

echo '<td><form action=" \' $_SERVER[\'PHP_SELF\'] \' " method="POST" class="Keuze">
        <select  name="Keuze"> 
        <option>0</option> 
        <option>1</option> 
        <option>2</option> 
        <option>3</option> 
        <option>4</option> 
        <option>5</option> 
        </select> 
        <p><input type="submit" name="submit" value="Bestellen"></p> 
        </form></td>';

How do I fix this so it can find it and if I want to use a different file than this file I already work in how should I do that?

  • 写回答

2条回答 默认 最新

  • drd0833 2013-07-28 11:39
    关注

    there is couple of things wrong with your string formation.

     action=" \' $_SERVER[\'PHP_SELF\'] \' " 
              ^-----------^---------^---^--- you have escaped the 
     terminating single quotes causing the string to not terminate. 
     also you have escape the single quotes in key association. also
     you have included the variable inside a single quote block causing the 
     variable not to expand. the result is a literal  $_SERVER['PHP_SELF'] ' 
     being displayed.
    

    the proper way to handle this situation would be as follows

    echo '<td><form action="' . $_SERVER['PHP_SELF'] . '" .....
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi