搜索
首页后端开发php教程PHP 表单传递参数与获取参数问题

<html><head><title>Register</title></head><body>	<?php	if (!isset($_POST['register1']) || ( $_POST['register1'] != 'Register'))	{			#echo "test1";	?>	<h1 id="Registration">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>


初学 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 id="Registration">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>

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

<html><head><title>Register</title></head><body>    <?php    if (!isset($_POST['register1']) || ( $_POST['register1'] != 'Register'))    {            #echo "test1";    ?>    <h1 id="Registration">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>

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


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

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


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

<form method = "post" action = "">

给自己提交不写都可以。

<form method = "post" action = "">

给自己提交不写都可以。


也是不行 ,获取一个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的配置吧

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

声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
如何使PHP应用程序更快如何使PHP应用程序更快May 12, 2025 am 12:12 AM

tomakephpapplicationsfaster,关注台词:1)useopcodeCachingLikeLikeLikeLikeLikePachetoStorePreciledScompiledScriptbyTecode.2)MinimimiedAtabaseSqueriSegrieSqueriSegeriSybysequeryCachingandeffeftExting.3)Leveragephp7 leveragephp7 leveragephp7 leveragephpphp7功能forbettercodeefficy.4)

PHP中的依赖注入:一个简单的解释PHP中的依赖注入:一个简单的解释May 10, 2025 am 12:08 AM

依赖性(di)inphpenhancesCodeFlexibility andTestability by decouplingClassesscyclasses fromtheippentencies.1)UseConstructorientoctionTopAssDopassDectiesViactructors Viactructors

PHP DI容器比较:选择哪一个?PHP DI容器比较:选择哪一个?May 10, 2025 am 12:07 AM

推荐Pimple用于简单项目,Symfony的DependencyInjection用于复杂项目。1)Pimple适合小型项目,因其简单和灵活。2)Symfony的DependencyInjection适合大型项目,因其功能强大。选择时需考虑项目规模、性能需求和学习曲线。

PHP依赖注入:什么,为什么以及如何?PHP依赖注入:什么,为什么以及如何?May 10, 2025 am 12:06 AM

依赖性注射(DI)InphpisadesignpatternwhereClassDepentenciesArepassedtotosedTosedTosedTotratherThancReateDinterally,增强codemodemodularityAndTestabily.itimprovessoftwarequalitybyby By:1)增强tosestabilityTestabilityTestabilityThroughityThroughEasyDepentyDepententymydependentymocking,2)增强Flexibilybya

PHP中的依赖注入:最终指南PHP中的依赖注入:最终指南May 10, 2025 am 12:06 AM

依赖性(di)InphpenhancesCodemodularity,可检验性和确定性。1)itallowSeasysWappingOfComponents,AsseeninaPaymentGateWayswitch.2)dicanbeimimplementlededMermplemplemplemplemplemplemplemplemplempletallyororororerorviacontainers,withcontanersAddingComplexiteDcomplexiteDcomplexiteDcomplexitingCompleaDdingCompleAddingButaidLararArargerProprproproprys.3)

优化PHP代码:减少内存使用和执行时间优化PHP代码:减少内存使用和执行时间May 10, 2025 am 12:04 AM

TOOPTIMIZEPHPCODEFORDUSEMEMORYUSAGEAGEAGEAGEAGEAGEANDEXECUTITIEM,关注台词:1)USEREEREFERESCENCENCINCOPYINSTEADOFCOPYINGINATATASTRUCTURESTROUCTURESTOREDUCEMORYCONSUMPTION.2)杠杆phphppphpphp'sbuilt intimpunctionslikearray_mapforfunctionslikearray_mapforfforfforfforfasterapasterexecution.3)

PHP电子邮件:分步发送指南PHP电子邮件:分步发送指南May 09, 2025 am 12:14 AM

phpisusedforsendendemailsduetoitsignegrationwithservermailservicesand andexternalsmtpproviders,自动化notifications andMarketingCampaigns.1)设置设置yourphpenvironcormentswironmentswithaweberswithawebserverserverserverandphp,确保themailfunctionisenabled.2)useabasicscruct

如何通过PHP发送电子邮件:示例和代码如何通过PHP发送电子邮件:示例和代码May 09, 2025 am 12:13 AM

发送电子邮件的最佳方法是使用PHPMailer库。1)使用mail()函数简单但不可靠,可能导致邮件进入垃圾邮件或无法送达。2)PHPMailer提供更好的控制和可靠性,支持HTML邮件、附件和SMTP认证。3)确保正确配置SMTP设置并使用加密(如STARTTLS或SSL/TLS)以增强安全性。4)对于大量邮件,考虑使用邮件队列系统来优化性能。

See all articles

热AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover

AI Clothes Remover

用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool

Undress AI Tool

免费脱衣服图片

Clothoff.io

Clothoff.io

AI脱衣机

Video Face Swap

Video Face Swap

使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

适用于 Eclipse 的 SAP NetWeaver 服务器适配器

将Eclipse与SAP NetWeaver应用服务器集成。

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

EditPlus 中文破解版

EditPlus 中文破解版

体积小,语法高亮,不支持代码提示功能

MinGW - 适用于 Windows 的极简 GNU

MinGW - 适用于 Windows 的极简 GNU

这个项目正在迁移到osdn.net/projects/mingw的过程中,你可以继续在那里关注我们。MinGW:GNU编译器集合(GCC)的本地Windows移植版本,可自由分发的导入库和用于构建本地Windows应用程序的头文件;包括对MSVC运行时的扩展,以支持C99功能。MinGW的所有软件都可以在64位Windows平台上运行。

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

功能强大的PHP集成开发环境