HTML code
The code is as follows |
Copy Code |
<title> Survey Table </title> <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "> <body bgcolor= "#FFFFFF" > <?php Define display form functions function Display_form () { Global $PHP _self; ?> <form action= "<?php echo $PHP _self;?>" method=post> Name: <input type=text name= "name" ><BR> Single selection: <input Type=radio name= "A" value= "I'm stupid" > I'm smart. <input Type=radio name= "A" value= "I'm very stupid" > I'm stupid. <input type=radio name= "First" value= "I'm just a dork." > I'm just an idiot <br> Multiple choices: <input type=checkbox name= "second[" value= "I like playing basketball" > I like playing basketball. <input type=checkbox name= "second[" value= "I like swimming" > I like swimming <input type=checkbox name= "second[" value= "I like dancing" > I like dancing. <input type=checkbox name= "second[" value= "I like mountain climbing" > I like hiking <input Type=hidden name= "stage" value= "Results" ><p> <input type=submit value= "Thank you" ></p> </FORM> <?php } ?> |
Program start
The code is as follows |
Copy Code |
<?php Defining processing form functions function Process_form () { Global $name; Global $first; Global $second; if ($first = ' I'm stupid ') { $first _message = ' You're not stupid. '; } ElseIf ($first = ' I'm very smart ') { $first _message = ' You're not smart. '; } else { $first _message = ' You are just like a smart person. '; } $favorite _second = count ($second); if ($favorite _second <= 1) { $second _message = ' but you have done wrong, repent! '; } ElseIf ($favorite _second > 1 && $favorite _second < 4) { $second _message = ' You are a sport-loving orangutan. '; } else { $second _message = ' You're exercising too much, and you're already overdoing it for chimps: ('; } echo "This is a test:<br><br> for chimpanzees"; echo "Hello!" Your name is: $name. <br><br> "; echo "Your test results are ..... $first _message $second _message "; } ?> <?php if (empty ($stage)) {display_form ();} else {process_form ();} ?> |
</body>
Voting and in line investigation System example principle is to do a single or marquee, collect the user's information in the score.