<Html>
<Head>
<Title> vote </title>
<META http-equiv = Content-Language content = zh-cn>
<META http-equiv = Content-Type content = "text/html; charset = gb2312">
<Style type = "text/css">
<! --
. Poll {font-size: 10pt; display: block}
. Pollresult {font-size: 12pt; display: none}
-->
</Style>
<? Php (as the mainstream development language)
Include_once ("server1.server. php (as the mainstream development language)"); # servidor para Xajax (static dynamic website)
$ Xajax (static dynamic website)-> printJavascript ();
?>
</Head>
<Body>
<Script language = javascript>
Function back (){
Document. getElementById (poll). style. display = block;
Document. getElementById (pollresult). style. display = none;
Document. getElementById (pollresult). innerHTML =;
}
</Script>
<Div id = pollresult class = pollresult>
</Div>
<? Php (as the mainstream development language)
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 ");
?>
<Div id = poll class = poll>
<Form id = "pollForm" action = "javascript: void (null);" onsubmit = "onSubmit ();">
<? Php (as the mainstream development language) echo $ poll ["title"];?> <Br>
<? Php (as the mainstream development language) for ($ I = 0, $ count = count ($ pollitems); $ I <$ count; $ I ++) {?>
<Input type = "radio" style = "background-color: # CCCCCC;" name = "pollitem" value = "<? Php (as the mainstream development language) echo $ pollitems [$ I] [pollitem_id]?> "> <? Php (as the mainstream development language) echo $ pollitems [$ I] [content]?> <Br>
<? Php (as the mainstream development language)}?>
<Input type = "hidden" name = "poll_id" value = "<? Php (as the mainstream development language) echo $ poll_id;?> ">
<Input type = "submit" value = "enter">
</Form>
<Script language = javascript>
Function onSubmit (){
Xajax (static dynamic website) _ poll (xajax (static dynamic website). getFormValues ("pollForm "));
Document. getElementById (poll). style. display = none;
Document. getElementById (pollresult). style. display = block;
}
</Script>
</Div>
</Body>
</Html>
Server
Function poll ($ formData ){
Global $ db;
$ Tmp = "";
$ ObjResponse = new xajax (static dynamic website) Response ();
$ Poll_id = $ formData [poll_id];
$ Pollitem_id = $ formData [pollitem];
If ($ pollitem_id> 0 & $ poll_id> 0 ){
$ Db-> query ("update". TBL_POLLITEM. "set count = count + 1 where pollitem_id = $ pollitem_id ");
}
$ Poll = $ db-> getRow ("select * from TBL_POLL where poll_id = $ poll_id ");
$ Pollitems = $ db-> getAll ("select * from TBL_POLLITEM where poll_id = $ poll_id ");
$ Tmp. = "<div align = center>". $ poll ["title"]. "</div> <br> ";
For ($ I = 0, $ count = count ($ pollitems); $ I <$ count; $ I ++ ){
$ Tmp. = "<div align = left> ". $ pollitems [$ I] [content]. ":". $ pollitems [$ I] [count]. "</div> ";