PHP 表单传递参数与获取参数问题

WBOY
Release: 2016-06-23 13:53:40
Original
951 people have browsed it

<html><head><title>Register</title></head><body>	<?php	if (!isset($_POST['register1']) || ( $_POST['register1'] != 'Register'))	{			#echo "test1";	?>	<h1>Registration</h1>	<form method = "post" action = "register.php">		<table>			<tr><td>E-mail address:</td>				<td><input type='text' name = 'email'/></td>			</tr>			<tr><td>First Name:</td>				<td><input type = 'text' name = 'first_name'/></td>			</tr>			<tr><td>Last Name:</td>				<td><input type = 'text' name = 'last_name'/></td>			</tr>			<tr><td>PassWord:</td>				<td><input type = 'password' name = 'password'/></td>			</tr>			<tr>				<td colspan = '2'>					<input type = 'submit' name = 'register1' value = 'Register'/>				</td>			</tr>		</table>	</form>	<?php		}		else		{	?>	E-mail:	<?php 		echo $_POST['email']; 	?>	<br />	Name:	<?php 		echo $_POST['last_name']; 	?>	<br />	Password:	<?php 		echo $_POST['password']; 	?>	<?php		}	?></body></html>
Copy after login


初学 PHP 问个问题 在这里 获取
E-mail:
echo $_POST['email'];
?>


Name:


Password:

这些信息时 只输出一个没问题
当我输出多个的时候像这个样子的
E-mail:
echo $_POST['email'];
?>


Name:
echo $_POST['last_name'];
?>


Password:
echo $_POST['password'];
?>
他就出错了 - -!!!
总是出现
An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.
这个东西 只输出一个时就可以
各位大神请指教


回复讨论(解决方案)

SF 不留

<html><head><title>Register</title></head><body>    <?php    if (!isset($_POST['register1']) || ( $_POST['register1'] != 'Register'))    {            #echo "test1";    ?>    <h1>Registration</h1>    <form method = "post" action = "">        <table>            <tr><td>E-mail address:</td>                <td><input type='text' name = 'email'/></td>            </tr>            <tr><td>First Name:</td>                <td><input type = 'text' name = 'first_name'/></td>            </tr>            <tr><td>Last Name:</td>                <td><input type = 'text' name = 'last_name'/></td>            </tr>            <tr><td>PassWord:</td>                <td><input type = 'password' name = 'password'/></td>            </tr>             <tr>                <td colspan = '2'>                    <input type = 'submit' name = 'register1' value = 'Register'/>                </td>            </tr>        </table>    </form>    <?php        }        else        {    ?>    E-mail:    <?php         echo $_POST['email'];     ?>    <br />    Name:    <?php         echo $_POST['first_name'].$_POST['last_name'];     ?>    <br />    Password:    <?php         echo $_POST['password'];     ?>    <?php        }    ?></body></html>
Copy after login
Copy after login

我给你调成这样本地测试时可以了。

<html><head><title>Register</title></head><body>    <?php    if (!isset($_POST['register1']) || ( $_POST['register1'] != 'Register'))    {            #echo "test1";    ?>    <h1>Registration</h1>    <form method = "post" action = "">        <table>            <tr><td>E-mail address:</td>                <td><input type='text' name = 'email'/></td>            </tr>            <tr><td>First Name:</td>                <td><input type = 'text' name = 'first_name'/></td>            </tr>            <tr><td>Last Name:</td>                <td><input type = 'text' name = 'last_name'/></td>            </tr>            <tr><td>PassWord:</td>                <td><input type = 'password' name = 'password'/></td>            </tr>             <tr>                <td colspan = '2'>                    <input type = 'submit' name = 'register1' value = 'Register'/>                </td>            </tr>        </table>    </form>    <?php        }        else        {    ?>    E-mail:    <?php         echo $_POST['email'];     ?>    <br />    Name:    <?php         echo $_POST['first_name'].$_POST['last_name'];     ?>    <br />    Password:    <?php         echo $_POST['password'];     ?>    <?php        }    ?></body></html>
Copy after login
Copy after login

我给你调成这样本地测试时可以了。


弱弱的问下 改了下哪里 我把你这个代码复制下来 还是不可以 ,是不是有什么的放需要配置或者其他的呢?

Copy after login

我给你调成这样本地测试时可以了。


看到你改的了 不过我改一下 还是不行 只输出一个时可以 输出多个时就不行了

<form method = "post" action = "">
Copy after login
Copy after login

给自己提交不写都可以。

<form method = "post" action = "">
Copy after login
Copy after login

给自己提交不写都可以。


也是不行 ,获取一个post值可以只要获取多个就不行了 ,我现在用的是阿里云的服务 配置的lnmp环境 
在想是不是跟那个配置有关系啊?

print_r($_POST);
看看是什么

print_r($_POST);
看看是什么



输入

输出的是
Array ( [email] => test@qq.com [first_name] => test_first [last_name] => test-last [password] => test_password [register1] => Register )
看这个输出应该是对的 - -! 

???,?有??。
你既然能print_r出?。表示可以?取到的。

???,?有??。
你既然能print_r出?。表示可以?取到的。


是的 现在怀疑是不是哪里配置出问题了 又或者其他的  单独取一个是可以的 取多个的时候  就不干活了  

你这个应该是服务器的问题吧,代码获取没有什么问题。

检查一下错误日志看报什么错误。PHP的错误提示功能也打开试试。

你这个应该是服务器的问题吧,代码获取没有什么问题。



检查一下错误日志看报什么错误。PHP的错误提示功能也打开试试。



是的 应该是哪里配置的问题 等回去了再看吧

错误级别  的问题~你的错误级别的什么?

错误级别  的问题~你的错误级别的什么?


没有配置错误级别 ,使用的默认的错误级别?

从nginx中找到这个日志
2014/07/18 20:37:33 [error] 9397#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 118.199.7.180, server: localhost, request: "POST /zp/chapter5/register.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost", referrer: "http://localhost/zp/chapter5/register.php"

大神给分析下 是什么问题

从nginx中找到这个日志
2014/07/18 20:37:33 [error] 9397#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 118.199.7.180, server: localhost, request: "POST /zp/chapter5/register.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost", referrer: "http://localhost/zp/chapter5/register.php"

大神给分析下 是什么问题


这个报错可以看这里
http://www.php100.com/html/program/nginx/2013/0905/5522.html
测试你的代码是没问题的,看下ngnix的配置吧

试了各种方法 暂时没有找到解决办法 结贴了 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!