duansha8115 2013-06-25 08:18
浏览 84
已采纳

表单提交到错误的URL在PHP中

I am creating a simple registration form in html and submitting it via post method to register.php which is under a directory named controller. When I submit the form, it redirects to wrong URL.
This is the form:

<form action="controller/register.php" method="post" enctype="multipart/form-data" id="pre-registration-form"> 
<fieldset>
    <legend><span>Type of Entry</span></legend>
    <table id="rally-type">
        <tr>
            <td>Sponsored</td>
            <td>Non-sponsored</td>
        </tr>
        <tr>
            <td><input type="radio" id="xtreme" name="entry-type" value="xtreme" /></td>
            <td><input type="radio" id="ndure" name="entry-type" value="ndure" /></td>
        </tr>
    </table>
</fieldset>
<fieldset>
    <legend>
        <span>Vehicle Details</span>
    </legend>
    <table>
        <tr>
            <td>Category</td>
            <td><select name="vehicle-category" id="vehicle-category-list">
                    <option value="0">Select</option>
                    <option value="2whlr">2 Wheeler</option>
                    <option value="2whlr">4 Wheeler</option>
                    <option value="2whlr">4 Wheel Drive</option>
                </select></td>
            <td>Make</td>
            <td>
                <select name="vehicle-make">
                    <option value="0">....</option>
                    <option value="1">....</option>
                    .
                    .
                    .
                </select>
            </td>

        </tr>
        <tr>
            <td>Model</td>
            <td><input type="text" name="make-model" /></td>
            <td>Year</td>
            <td><input type="text" name="make-year" /></td>
        </tr>
    </table>
</fieldset>
.
.
.
.
<input type="submit" name="submit" value="Submit" />

When I try to submit the form, it redirects to controller/index.php rather than controller/register.php
When I rename register.php file to index.php then the firefox gives the following error:

The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

This problem can sometimes be caused by disabling or refusing to accept cookies.



I have tried this on wamp as well as lamp server and both produces the same error. What might be the root of this problem?

  • 写回答

2条回答 默认 最新

  • dongshendie8849 2013-06-25 08:36
    关注

    It looks like in controller/register.php u have any check which redirect it to index of controller. please make it sure otherwise it will not redirect it to any page so make sure of this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试