Home > Backend Development > PHP Tutorial > submit提交的问题

submit提交的问题

WBOY
Release: 2016-06-23 13:55:08
Original
1169 people have browsed it

<html>  <head>  	<meta http-equiv="Content-Type" content="text/html; charset=gb2312">  	<style type="text/css">			//body { font-family:Verdana; font-size:12px; margin:0 auto;}			//#container {margin: 0 auto; width:70%;}						th { background-color:#0099CC;color:#FFFFFF;}			tr { background-color:#F0F8FF;text-align:center;}			td { background-color:#CCFFCC;}			td.pack { background-color:#00FFFF;}		</style>  </head>    <body BACKGROUND='https://mobile.yungtay.com.cn/image/bgp.gif'>  	<center><h2>BARCODE扫描??成品统计(箱号、储位维护)</h2>    <form name=query action='' method=get>	  	<table style="width: 100%" class="style3">	  <tr>		 		<th>储位</th>	  </tr>	<tr>		 	   <td><input type="text" size=70 name="Storage">	   <input type="submit" value="新增/修改">   	   	   </td>	 </tr>	  </table>			<hr>		</form>	<?        		 if(isset($_GET['Storage'])){		  $Storage = intval( $_GET['Storage'] );		}              echo  $Storage;?>		</body></html>
Copy after login

问题点是:输入非数字,输出为0,中文和字符无法正常显示。


回复讨论(解决方案)

intval变量转成整数类型。所以只能输出数字,其余类型自动转换为int

对呀,你就是这样设计的!
$Storage =  intval( $_GET['Storage'] );
把传入的数据转换为整数

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