Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/256.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 为什么我的表单重定向到自身而不是重定向到指定的目标?_Php_Html_Redirect_Forms_Http Post - Fatal编程技术网

Php 为什么我的表单重定向到自身而不是重定向到指定的目标?

Php 为什么我的表单重定向到自身而不是重定向到指定的目标?,php,html,redirect,forms,http-post,Php,Html,Redirect,Forms,Http Post,出于某种原因,单击“提交”后,我的页面只会重定向回空表单。我似乎想不出原因。我唯一的猜测是,它没有认识到“submit”是真的,只是通过else子句返回到它自己。但是,我已经将表单的操作切换到一个已定义的URL(eg),并让它将我发送到目标。非常感谢您的帮助 编辑:我已经能够可靠地显示,这是我的表单标记的操作值,它的行为不正常 我执行了以下测试:我可以输入if/else语句的任意一个条件,并使该值在条件下面回音。但是,如果我尝试在表单上方回显,它将不返回任何内容,但我在表单中输入的值将在表单上方

出于某种原因,单击“提交”后,我的页面只会重定向回空表单。我似乎想不出原因。我唯一的猜测是,它没有认识到“submit”是真的,只是通过else子句返回到它自己。但是,我已经将表单的操作切换到一个已定义的URL(eg),并让它将我发送到目标。非常感谢您的帮助

编辑:我已经能够可靠地显示,这是我的表单标记的操作值,它的行为不正常

我执行了以下测试:我可以输入if/else语句的任意一个条件,并使该值在条件下面回音。但是,如果我尝试在表单上方回显,它将不返回任何内容,但我在表单中输入的值将在表单上方回显(例如,conferenceName as$\u POST['conferenceName']将在表单上方回显)


会议注册[此页面尚未激活]

您将PHP echo括在引号中,这在以下行中是错误的:

$action = '"<?php echo $_SERVER["PHP_SELF"]; ?>"';

您可以在action变量中使用“#”或分配$_SERVER[“PHP_SELF”]。

靠近底部的一行,如果不是
$action=$_SERVER['PHP_SELF']?粘贴呈现的html代码。在实现建议后添加html输出。
<!DOCTYPE html>
<!-- saved from url=(0044)http://example.net/conference-registration.php -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>Conference Registration [This Page Not Yet Active]</title>
        <link rel="stylesheet" type="text/css" href="./Conference Registration [This Page Not Yet Active]_files/cmxform.css">
    </head>
    <body>
        <form method="post" action="" class="cmxform">
        <fieldset>
            <legend>Example Conference Registration</legend>
            <ol style="list-style-type: none;">
                <li>
                    <label for="conferenceName">Applicant's Name<em>*</em></label> <input name="conferenceName" type="text">
                </li>
                <li>
                    <label for="conferenceAgencySchool">Agency School<em>*</em></label> <input name="conferenceAgencySchool" type="text">
                </li>
                <li>
                    <label for="conferenceAgencyAddress">Agency Address<em>*</em></label> <input name="conferencePhysicalAddress" type="text">
                </li>
                <li>
                    <label for="conferenceCity">City<em>*</em></label> <input name="conferenceCity" type="text">
                </li>
                <li>
                    <label for="conferenceState">State<em>*</em></label> <input name="conferenceState" type="text">
                </li>
                <li>
                    <label for="conferenceZip">Zip<em>*</em></label> <input name="conferenceZip" type="text">
                </li>
                <li>
                    <label for="conferencePhone">Phone<em>*</em></label> <input name="conferencePhone" type="text">
                </li>
                <li>
                    <label for="conferenceExtension">Extension</label> <input name="conferenceExtension" type="text">
                </li>
                <li>
                    <label for="conferenceNumberOfAttendees">Number of Attendees<em>*</em></label> <input name="conferenceNumberOfAttendees" type="text">
                </li>
                <li>
                    <label for="conferencePointOfContactName">P.o.C. Name<em>*</em></label> <input name="conferencePointOfContactName" type="text">
                </li>
                <li>
                    <label for="conferencePointOfContactPhone">P.o.C. Cell Phone<em>*</em></label> <input name="conferencePointOfContactPhone" type="text">
                </li>
                <li>
                    <label for="conferencePointOfContactEmail">P.o.C. Email<em>*</em></label> <input name="conferencePointOfContactEmail" type="text">
                </li>
                <li>
                    <label for="conferenceAdditionalAttendeeInfo">Additional Attendee(s) Info</label> 
                    <textarea name="conferenceAdditionalAttendeeInfo" style="height: 100px; width: 90%; max-width: 90%; min-width: 90%;" wrap="soft"></textarea>
                </li>
            </ol>
            <hr>
            <legend>Method of Payment<em>*</em></legend>
            <ol style="list-style-type: none;">
                <li>
                    <label><input name="payment" type="radio" value="Online">Online</label>
                </li>
                <li>
                    <label><input name="payment" type="radio" value="At The Door"> At the Door</label>
                </li>
                <li>
                    <label>Invoice # (If Using Invoice)</label><input name="invoiceNumber" type="text">
                </li>
            </ol>
            <hr>
        </fieldset><input name="submit" type="submit" value="Submit Application">
        </form>

<script type="text/javascript" async="" src="./Conference Registration [This Page Not Yet Active]_files/si.js"></script></body></html>
$action = '"<?php echo $_SERVER["PHP_SELF"]; ?>"';
$action = $_SERVER["PHP_SELF"];