Home > Backend Development > PHP Tutorial > PHP 代码 在下来框判断报错

PHP 代码 在下来框判断报错

WBOY
Release: 2016-06-23 14:38:15
Original
910 people have browsed it

 <th width="61" align="right">账户</th>    <td align="left"><input name="edno" type="text" value="<?php echo $zhanghu; ?>" /></td><!--  上面是正确的 -->	<th width="61" align="right">类型</th>    <td align="left">    	    	<select id="leixing" name="leixing">           <option value=''<?php if('"$leixing"') == ''){echo 'selected="selected"';}?>>全部</option>  <!-- 为什么页面会报错? -->           <option value='1'<?php if('"$leixing"') == '1'){echo 'selected="selected"';}?>>是</option>           <option value='2'<?php if('"$leixing"') == '2'){echo 'selected="selected"';}?>>否</option>        </select>    </td>
Copy after login
Copy after login


回复讨论(解决方案)

 <th width="61" align="right">账户</th>    <td align="left"><input name="edno" type="text" value="<?php echo $zhanghu; ?>" /></td><!--  上面是正确的 -->	<th width="61" align="right">类型</th>    <td align="left">    	    	<select id="leixing" name="leixing">           <option value=''<?php if('"$leixing"') == ''){echo 'selected="selected"';}?>>全部</option>  <!-- 为什么页面会报错? -->           <option value='1'<?php if('"$leixing"') == '1'){echo 'selected="selected"';}?>>是</option>           <option value='2'<?php if('"$leixing"') == '2'){echo 'selected="selected"';}?>>否</option>        </select>    </td>
Copy after login
Copy after login


在线等 大虾们 出来吧!

if($leixing == '')
下面那两个类似

if($leixing == '')
下面那两个类似
----------------------------
Parse error: syntax error, unexpected '==' (T_IS_EQUAL)
还是报错

你的代码是怎么写的?

<select id="leixing" name="leixing">           <option value=''<?php if($leixing == ''){echo 'selected="selected"';}?>>全部</option>  <!-- 为什么页面会报错? -->           <option value='1'<?php if($leixing == '1'){echo 'selected="selected"';}?>>是</option>           <option value='2'<?php if($leixing == '2'){echo 'selected="selected"';}?>>否</option>        </select>
Copy after login

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