duangong0690 2012-03-17 19:07
浏览 18

PHP形式 ​​- '得到'工作,但'发布'没有

I have a simple registration form. I've been searching for hours and tried everything - basically I've stripped it down to post/get. When I set the method to get (on both the form and script page) it works fine, when I set it to post, I get this error:

Not Acceptable

An appropriate representation of the requested resource /tmp/register.php could not be found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Here is my code on the form page:

<form id="registration" onsubmit="return validateRegistration();" action="register.php" method="post">
    Name:     <input type="text" id="name" name="name" placeholder="Required">
    <br>
    Email:    <input type="email" id="email" name="email" placeholder="Required">
    <br>
    Confirm:  <input type="email" id="confirm_email" autocomplete="off" placeholder="Required">
    <br>
    Password: <input type="password" id="password" name="password" placeholder="Required">
    <br>
    Confirm:  <input type="password" id="confirm_password" autocomplete="off" placeholder="Required">
    <br>
    City:     <input type="text" id="city" name="city" placeholder="Optional">
    <br>
    Country:  <input type="text" id="country" name="country" placeholder="Optional">
    <br>
    <br>
    <hr>
    <a href="#">Terms and Conditions</a>
    <br>
    <input type="submit" value="Accept and Complete Registration">
</form>

And on my script page (register.php), I have:

<?php
    echo "Name: " . $_POST["name"] . "<br>";
    echo "Email: " . $_POST["email"] . "<br>";
    echo "Password: " . $_POST["password"] . "<br>";
    echo "Location: " . $_POST["city"] . ", " . $_POST["country"] . "<br>";
?>

If I just go to register.php it just shows blanks where the Posts are, but if I submit the form it gives the Not Acceptable 406 error.

Can someone please help me with this? I'm totally boggled. Thanks

  • 写回答

4条回答 默认 最新

  • douji5523 2012-03-17 20:54
    关注

    The error code says it's looking for the file at /tmp/register.php. Is that correct? Perhaps change the form action to /register.php?

    Also, your PHP looks a bit off (lots of extra quotes), but I'm assuming you just copy/pasted from the php file and some reason deleted the surrounding HTML?

    评论

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器