【 tulaoshi.com - PHP 】
投票管理程序
表结构
CREATE TABLE poll(Poll_Id INT (11) not null AUTO_INCREMENT,Poll_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , PRIMARY KEY (Poll_Id))
CREATE TABLE pollsele(Pollsele_Id INT (11) not null AUTO_INCREMENT,Pollsele_Name char(50) ,Poll_Del INT (10) DEFAULT '0' , Pollsele_poll_Id INT (10) ,pollsele_num int (10), PRIMARY KEY (Pollsele_Id))
-------------------------------------------------------------------------------------------------
poll.php //主程序
<? $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_id,Poll_Name from poll where poll_del='1'";
@$result = mysql_query($sql);
$myrow=mysql_fetch_row($result);
echo "<table align=center bgcolor=aabbcc width=250 hight=450 border=0 style='border:1px solid rgb(0,0,0)'";
echo "<td align=center bgcolor=99aabb style='border:1px solid rgb(255,255,255)'";
echo "$myrow[1]";
$sql="select Pollsele_Name,pollsele_poll_id from pollsele where pollsele_del='0' and pollsele_poll_id='$myrow[0]'";
@$result = mysql_query($sql);
echo "<FORM ACTION='pollsee.php?poll_id=$myrow[0]' METHOD='post' target=_blank";
echo "<p align=center";
while($myrow=mysql_fetch_row($result))
{
echo "<input type='radio' name=toupiao value='$myrow[0]'$myrow[0]";
echo " "; }
echo "<br"; echo "<br";
echo "<input type=submit name=submit value='投票' ";
echo "</p";
echo "</form"; echo "</td";
echo "</table";
mysql_close();
echo "<br";
echo "<p align=right";
echo "<a href=poll_input管理</a"; echo "</p"; ?
-----------------------------------------------------------------------
poll_input.php //添加主题
<? $db =mysql_connect("localhost", "root","391450");
mysql_select_db("class",$db);
$sql="select poll_id,poll_name,poll_del from poll";
echo "<table width=300 hight=560 bgcolor=aabbcc align=center style='border:1px solid rgb(0,0,0)'";
$result=mysql_query($sql);
while($my=mysql_fetch_row($result))
{
echo "<tr";echo "<td align=center width=50 bgcolor=99aabb style='border: 1px solid rgb(255,255,255)'";echo $my[0];echo "</td";
&