document.open(); document.writeln(''); // below we write any error messages or if all clear we write the html for the poll itself // here we are writing a script file that checks to make sure that people have both predicted and voted when they submit // note we split up the script tag // note we are even making sure of a unique form name based on the poll id // we do this because on a site with more than one poll for instance the Tapoll Tech blog, we would run into trouble with the same form name // this happens to be one of those debugging fixes ;-) // this is a good example of when you might need a combination of PHP and JavaScript happening // note how we return the results of the validate function on the onClick() of the form submit button // the validate function checks the entries and if not complete it alerts a message and returns false; // finally when ready and all is filled in we return true; and the submit click goes through // look on the radio buttons to see how we change predictCheck and voteCheck to 1 using the onClick() event document.writeln(''); document.writeln('predictCheck = 0; voteCheck = 0;'); document.writeln('function validate918483666(f) {'); document.writeln('if (predictCheck == 0) {alert ("Please predict the most popular vote in the poll");return false;}'); document.writeln('if (voteCheck == 0) {alert ("Please enter your vote in the poll");return false;}'); document.writeln("document.pp_poll_918483666.action = 'http://www.tapoll.com/poll/results/';"); document.writeln('return true;}'); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln('
'); // sometimes the database adds slashes in front of single quotes and things like that - stripslashes() takes care of it document.writeln(''); // if we have voted then we show the results for the options otherwise we show radio buttons with options document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln(''); document.writeln('
Q!? Will Microsoft buy Yahoo?
Your prediction of the results
 Your vote
Yes
They will offer and Yahoo will say no
Yahoo will offer and Microsoft will say no
No
'); document.writeln('
'); // if we are remote then we track the view // we do not track the view on the Tapol portal as the views are tracked in part2.php var r=Math.round(Math.random()*1000000); document.writeln(''); document.close();