请问同一个文件中php怎么获取html的变量值

WBOY
Release: 2016-06-13 12:18:40
Original
842 people have browsed it

请教同一个文件中php如何获取html的变量值?

本帖最后由 zhouxicai 于 2015-04-29 10:56:49 编辑 代码如下:
<br /><html><br />	<head> <title>配置器</title> </head><br />	<body><br />		<br> 请设置您要修改的属性:<br> <br />		<form><br />			<table width="220" height="10" border="0" cellpadding="1" cellspacing="1">  <br />					<tr> <br />						<td align="center">金币: </td> <br />						<td align="center"><input name=jb type=TEXT value="555"></td> <br />					</tr><tr> <br />						<td align="center">经验:</td> <br />						<td align="center"><input name=jy type="TEXT" value="444" /></td> <br />					</tr><tr> <br />						<td align="center">道具:</td> <br />						<td align="center"><input name=dj type="TEXT" value="333" /></td> <br />					</tr><br />					<input type=SUBMIT value="测试"><br />			</table>  <br />		</form><br />	</body><br /><br />	<?php<br />    echo "</br>test connect.</br>"; <br />		echo ($jb);<br />		echo ($jb);<br />		echo ($jy);<br />	?><br /><br /></html> <br />
Copy after login


在浏览器打开这个index.php页面后 显示错误

Notice: Undefined variable: jb in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\command.php on line 32

Notice: Undefined variable: jb in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\command.php on line 33

Notice: Undefined variable: jy in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\command.php on line 34

我该如何在php代码中获取html的变量值了?
------解决思路----------------------
这个恐怕要用 js 来获取吧,你这个值是动态的,要么就是ajax传到后台php页面
------解决思路----------------------
你的这个代码早就过时了,是 php4 的早期代码
为了在 php 5.3 以前正确执行,需要有以下设置
register_globals = on
error_reporting = E_ALL & ~E_NOTICE

php5.4 开始取消了 register_globals 开关,你的代码不修改是不能正确运行的

如果你不想修改 php.ini 文件,也不想改动原有的代码
那么至少需要在程序的开始处,加上以下代码
error_reporting(E_ALL ^ E_NOTICE);<br />extract($_GET);
Copy after login


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