|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Voting poll article problem
Hi to all.
Please help me with my poll problem. This script is great and i want to put poll to my site. When i include poll.php and than vote, script redirect to next page and show result. How can i after voting open the same page (index) with result on right place. Sorry about language. |
|
#2
|
|||
|
|||
|
Hi Sass,
The best quickest way you can go about doing it is to have the form submit to $_SERVER['PHP_SELF'] rather than to the results page... You can then insert a hidden html tag on your voting page. When the form is submitted, check to see if the hidden tag is set... if it is, it means the vote has been submitted... Then just copy the code from the result page, and paste it into your index page. By using an IF statement, you can display the appropriate page: Code:
if (hidden_variable){
display results;
} else {
display voting question/poll
}
If you need further explanation, please let me know...
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
This was a good article, but I'd like to point out a couple of minor errors as well as make a suggestion:
1) In the "Page 3: Adding a poll to the database" section, the paragraph starting with "Let's take a look at how we add a poll to our database..." the last sentence states "The GetNewPollDetails function simply displays a HTML form containing five fields:..." but there are actually six fields, one for the poll question and five for the poll answers. 2) The code for the "AddPoll" function compares the $answer1, $answer2, etc. variables with the empty string, but I would think the trim() function should be called on the variables before doing the comparison. 3) Finally, I think it would be interesting to see an implementation of the voting poll application using an XML file as the backend, instead of a database. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > Voting poll article problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|