我在页面中有2个表单,但基本上表单操作,方法和字段名称是相同的。我制作了这两种形式,因为一种形式用于桌面,另一种用于移动屏幕。我只是在桌面屏幕而不是移动屏幕时隐藏一个表单。当我使用post时,在下一页中它显示一个空值。我没有得到任何后期价值。谁能说明为什么会这样?
/ *表示dekstop * /
<div class="LregisterI"><br><div class="close"><img src="<?=$img_loc?>close.png" id="btnClose"/> </div>
<div class="Lregister">
<form action="line_check.php" class="form" name="reg" method="POST" >
<table border="0" align="center" width="" style="">
<tr>
<td colspan="4">
<img src="<?=$img_loc?>regi.png" />
</td>
</tr>
<tr>
<td align="" width="78">Name</td>
<td>
<input type="text" id="name" name="name" value="" onfocus="document.getElementsByClassName('err1')[0].innerHTML=''" class="inputstyle h" />
</td>
<td align="center">Gender</td>
<td>
<div class="gender">
<div class="umale">
<input type="radio" name="gender" checked value="Male">
<label>Male</label>
</div>
<div class="ufemale">
<input type="radio" name="gender" value="Female">
<label>Female</label>
</div>
</div>
</td>
</tr>
<tr>
<td align="" width="78"></td>
<td height="10">
<div class="err err1" id="err1"></div>
</td>
<td align="center"></td>
<td>
<div></div>
</td>
</tr>
<tr>
<td colspan="4">
<div class="hline"></div>
</td>
</tr>
<tr>
<td height="10" colspan="4"></td>
</tr>
<tr>
<td align="">Password</td>
<td>
<input type="password" id="pword" name="pword" value="" onfocus="document.getElementsByClassName('err2')[0].innerHTML=''" class="inputstyle" />
</td>
<td align="center">Confirm Password</td>
<td>
<input type="password" id="spword" name="spword" value="" onfocus="document.getElementsByClassName('err3')[0].innerHTML=''" value="" class="inputstyle" />
</td>
</tr>
<tr>
<td align="" width="78"></td>
<td height="20">
<div class="err err2" id=""></div>
</td>
<td align="center"></td>
<td>
<div class="err err3" id=""></div>
</td>
</tr>
<tr>
<td align="">Email</td>
<td>
<input type="text" id="email" name="email" onfocus="document.getElementsByClassName('err4')[0].innerHTML=''" class="inputstyle" />
</td>
<td align="center">Collage</td>
<td>
<input type="text" id="college" name="college" onfocus="document.getElementsByClassName('err5')[0].innerHTML=''" value="" class="inputstyle" />
</td>
</tr>
<tr>
<td align="" width="78"></td>
<td height="20">
<div class="err err4" id=""></div>
</td>
<td align="center"></td>
<td>
<div class="err err5" id=""></div>
</td>
</tr>
<tr>
<td align="">Mobile</td>
<td>
<input type="hidden" name="reg" value="register">
<input type="text" id="no" name="number" value="" onfocus="document.getElementsByClassName('err6')[0].innerHTML=''" class="inputstyle" />
</td>
<td align="center">City</td>
<td>
<input type="text" id="city" name="city" value="" onfocus="document.getElementsByClassName('err7')[0].innerHTML=''" class="inputstyle" />
</td>
</tr>
<tr>
<td align="" width="78"></td>
<td height="10">
<div class="err err6" id=""></div>
</td>
<td align="center"></td>
<td>
<div class="err err7" id=""></div>
</td>
</tr>
<tr>
<td align="" width="78"></td>
<td colspan="3">
<input type="button" name="sub1" class="submit" value="" onclick="chk();" />
</td>
</tr>
</table>
</form>
</div>
/ * for Mobile * /
<div class="LregisterS">
<form action="line_check.php" class="form" name="reg" method="POST" >
<img src="./static/img/regi.png" height="43">
<div class="name">
<div class="fl">Name</div>
<input type="text" id="name" name="name" onfocus="document.getElementsByClassName('err1')[1].innerHTML=''" class="inputstyle h fr" />
</div>
<div class="err1 mT er " id=""></div>
<div class="name" >
<div class="fl" style="width:186px;">Gender</div>
<div class="umale fr"><input type="radio" name="gender" checked value="Male" class="umaleI" /><label>Male</label></div>
<div class="ufemale fr" ><input type="radio" name="gender" value="Female" class="ufemaleI" /> <label>Female</label></div>
</div>
<div class="email">
<div class="fl">Password</div>
<input type="password" id="pword" name="pword" value="" onfocus="document.getElementsByClassName('err2')[1].innerHTML=''" class="inputstyle h fr" />
</div>
<div class="err2 mT er " id=""></div>
<div class="mobile">
<div class="fl">Confirm Password</div>
<input type="password" id="spword" name="spword" value="" onfocus="document.getElementsByClassName('err3')[1].innerHTML=''" class="inputstyle h fr" />
</div>
<div class="err3 mT er " id=""></div>
<div class="email">
<div class="fl">Email</div>
<input type="hidden" name="reg" value="register">
<input type="text" id="email" name="email" onfocus="document.getElementsByClassName('err4')[1].innerHTML=''" class="inputstyle h fr" />
</div>
<div class="err4 mT er" id=""></div>
<div class="mobile">
<div class="fl">Collage</div>
<input type="text" id="college" name="college" onfocus="document.getElementsByClassName('err5')[1].innerHTML=''" class="inputstyle h fr" />
</div>
<div class="err5 mT er" id=""></div>
<div class="mobile">
<div class="fl">Mobile</div>
<input type="text" id="no" name="number" value="" onfocus="document.getElementsByClassName('err6')[1].innerHTML=''" value="" class="inputstyle h fr" />
</div>
<div class="err6 mT er " id=""></div>
<div class="mobile">
<div class="fl">City</div>
<input type="text" id="city" name="city" value="" onfocus="document.getElementsByClassName('err7')[1].innerHTML=''" value="" class="inputstyle h fr" />
</div>
<div class="err7 mT er " id=""></div>
<div class="sub"><input type="button" name="sub" class="submit" value="" onclick="chk();" /></div>
</form>
</div>
</div>
答案 0 :(得分:0)
我认为为此需要在php中使用$_SERVER['HTTP_USER_AGENT']
函数。使用它并检查它是来自PC还是来自mobiel