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

submit提交的有关问题

WBOY
WBOYOriginal
2016-06-13 12:00:01974browse

submit提交的问题

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

问题点是:输入非数字,输出为0,中文和字符无法正常显示。
------解决方案--------------------
intval变量转成整数类型。所以只能输出数字,其余类型自动转换为int
------解决方案--------------------
对呀,你就是这样设计的!
$Storage = intval( $_GET['Storage'] );
把传入的数据转换为整数

Statement:
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