php中页面及条件判断?

<?php session_start();include("conn/conn.php");?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投票系统中单选按钮与复选框的应用</title>
<style type="text/css">
<!--
.style1 {font-size: 13px}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.style2 {font-size: 12px}
-->
</style>
</head>

<body>
<table width="450" border="1" cellpadding="0" cellspacing="0" background="images/hhh.JPG">
<tr align="center">
<td height="25" colspan="4"><span class="style1">投票主题浏览</span></td>
</tr>
<?php
$result=mysql_query("select * from tb_poll");
while($myrow=mysql_fetch_array($result)){
$tpzt=$myrow[tpzt];
?>
<tr>
<td width="46"> </td>
<td height="25" colspan="2" align="center" class="style1"><a href="index.php?lmbs=投票专区&lmlb=<?php echo $tpzt;?>" title="参加投票"><?php echo $myrow[tpzt];?></a></td>
<td width="323"><span class="style2"> 说明: <?php echo $myrow[tpzt_sm];?></span></td>
</tr>
<?php }?>
<tr>
<td height="20" colspan="4" align="center"> </td>
</tr>
</table>
<p>
<?php
switch($lmbs and $lmlb){
case "$tpzt" :
include"indexs.php";
break;
}
?>
</p>
<p> </p>
</body>
</html>
页面indexs.php包含不进来,估计是条件判断的问题,求大侠指点!
上面的<a href="index.php?lmbs=投票专区&lmlb=<?php echo $tpzt;?>" title="参加投票">中lmbs 和 lmlb怎么来的,这条语句什么意思?switch($lmbs and $lmlb)又是什么意思?

当一个 case 语句中的值和 switch 表达式的值匹配时 PHP 才开始执行该语句,你检查一下他俩是否匹配。

<a href="index.php?lmbs=投票专区&lmlb=<?php echo $tpzt;?>" title="参加投票">中Lmbs=投票专区是你自己定义的,相当于传值,用$_GET接收。后面的lmlb=<?php echo $tpzt;?>是前面PHP循环出来的变量,它俩你可以在PHP页面通过get方式得到变量也就是你后面switch里面所需要的$lmbs and $lmlb。

and是逻辑运算‘与’,如果 $lmbs 与 $lmlb 都为 TRUE 的时候结果才为TRUE
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-09-05
<a href="index.php?lmbs=投票专区&lmlb=<?php echo $tpzt;?>" title="参加投票">
lmbs=投票专区这个没什么好说 自己定义的
lmlb=<?php echo $tpzt;?>" 这个就是把这条投票记录定义了一个编号,所以他从数据库里取了
switch($lmbs and $lmlb){ switch-case语句
case "$tpzt" : 这条我也不知道他是什么意图 貌似也没有赋值
include"indexs.php"; 包含文件indexs.php
break; 退出循环
}
第2个回答  2009-09-05
把这段改一下:
<?php
switch($lmbs and $lmlb){
case "$tpzt" :
include"indexs.php";
break;
}
?>
改成:

<?php
$lmbs = $_GET["lmbs"];
$lmbs = $_GET["lmlb"];
switch($lmbs and $lmlb){
case "$tpzt" :
include"indexs.php";
break;
}
?>
第3个回答  2009-09-05
肯定有问题。,

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网