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