请高手帮忙看看!!!为什么以下代码利用internet上不能进行预览啦(页面上什么东西都没有,一片空白)?

nlw1984 2005-10-20 11:25:41
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style title="text/css">
<!--
body,td{
font-family:"宋体";
font-size:12px;
}
-->
</style>
</head>

<body>
<?php
include_once("dbclass.php")
if($db->getfirst("select * from iptable where
voteip='$_SERVER['REMOTE_ADDR']'")){
echo"您已经投过票了,谢谢您的参与!";
}
if(!$action){
echo"<table width=200 boder=0 cellpadding=2 cellspacing=1>";
echo"<form action='' method='post' name='voteform' onsubmit='return checkform(this)'>";

$myitems=$db->query("select * from itemtable");
$itemNo=0;
while($myitem=$db->getarray($myitem)){
echo"<tr>
<td nowrap style='cursor:default'
onclick='voteform.check$itemNo.click()'>
<input name='check$itemNo' type='checkbox' value='$myitem [id]'>
$myitem[name]
</td>
<tr> \n";
}
echo'<tr>
<td>
<input name="action" type="hidden" value="vote"><br>
<input name="submit" type="submit" value="投票">
<input name="reset" type="reset" value="重置">
</td>
</tr>';
echo"\n</form>\n</table>";
?>
<script language="javascript">
<!--
function checkform(myform){
checkedcount=0;
for(i=1;i<=<?php echo $itemNo ?>;i++){
mycheck=eval("myform.check"+i);
if(mycheck.check==true){
checkedcount++;
}
}
if(checkdcount==2){
return true;
}
else{
alert("对不起,您只能投两个项目!");
return false;
}
}
-->
</script>
<?php
}
else if($action="vote"){
$itemcount=$db->getfirst("select count(*) as count from itemtable");
$checkarray=array();
for($i=1;$i<=$itemcount["count"];$i++){
$mycheck="check$i";$mycheck=$$mycheck;
if($mycheck && $db->getfirst("select * from itemtable where id='$mycheck'")){
$checkarray[]=$mycheck;
}
}
if(count($checkarray)==2{
for($i=0;$i<count($checkarray);$i++){
$db->query("update itemtable set votes=votes+1 where id='$checkarray[$i]'");
}
$db->query("inset into iptable(voteip) values('$_SERVER['REMOTE_ADDR']')");
echo"投票成功,谢谢您的参与!";
}else{
echo"对不起,您只能投两个项目!";
}
}
?>
</body>
</html>
...全文
93 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhongjihang 2005-10-20
  • 打赏
  • 举报
回复
$db->getfirst("select * from iptable where voteip='$_SERVER['REMOTE_ADDR']'"))

echo "$_SERVER['REMOTE_ADDR']";//我试了一下不行
其他的我没看
你还是先把值取出来吧再赋吧
web_php 2005-10-20
  • 打赏
  • 举报
回复
检查一下数据库。
nlw1984 2005-10-20
  • 打赏
  • 举报
回复
TO:gu1dai
不行啊,有没有其他办法啊?谢谢
gu1dai 2005-10-20
  • 打赏
  • 举报
回复
然后刷新页面,一般空白页都是这个问题。
gu1dai 2005-10-20
  • 打赏
  • 举报
回复
ie中右键,选择编码-〉gb2312.

21,890

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧