实现一个基于Ajax的调查程序

本文介绍了一个使用PHP实现的在线投票系统的具体实现细节,包括如何通过数据库获取投票选项并展示给用户进行选择,同时集成了XAJAX技术来提升用户体验。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog01.html" frameborder="0" width="728" scrolling="no" height="90"></iframe>



投票
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css"><br/><!--<br/>.poll {font-size: 10pt;display:block}<br/>.pollresult {font-size: 12pt;display:none}<br/>--><br/></style>
<?php <br/>include_once("server1.server.php"); #servidor para XAJAX
$xajax->printJavascript();
?>



function back() {
document.getElementById('poll').style.display = 'block';
document.getElementById('pollresult').style.display = 'none';
document.getElementById('pollresult').innerHTML = '';
}


<?php </p>


global $db;

$poll = $db->getRow("select * from TBL_POLL order by poll_id desc limit 1");
$poll_id = $poll["poll_id"];
$pollitems = $db->getAll("select * from TBL_POLLITEM where poll_id=$poll_id");
?>



<?php echo $poll["title"]; ?>

<?php for ($i = 0, $count = count($pollitems); $i < $count; $i++) { ?>
<?php echo $pollitems[$i]['content'] ?>

<?php } ?>




function onSubmit() {
xajax_poll(xajax.getFormValues("pollForm"));
document.getElementById('poll').style.display = 'none';
document.getElementById('pollresult').style.display = 'block';
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值