Jump to content

PHP/MySQL poll script


Recommended Posts

I downloaded a php script but I'm not sure how to customise it.

Right now the user selects his poll answer and clicks on the VOTE submit button and it takes the user to a page where the results are. I do not want the results to be shown right away so how can I fix this script (I know the answer lies in the bolded area but I don't know what to put there):


<TH HEIGHT=26 VALIGN=bottom ALIGN=CENTER><div align="left"></div></TH>


<TD WIDTH=130> <FORM ACTION="myResults.php" METHOD="post" target="_blank">

<P STYLE="font: 11px Arial;"><strong>Are you whatever?</strong><BR>

<INPUT TYPE=radio NAME=choice VALUE='1'>

Yes I am<BR>

<INPUT TYPE=radio NAME=choice VALUE='2'>

no I am not<BR>

<INPUT TYPE=radio NAME=choice VALUE='3'>

I don't care<BR>

<INPUT TYPE=submit NAME=voted VALUE="Vote!" ALIGN=center target=>






Link to comment
Share on other sites


If u dont want the form to do anything for the moment then just make the action attribute blank:


This way the page will just refresh without any data passed on to the php script. Please also note that get rid of target="_blank" since it will just bring up a new window with the same form in it whenever u click on submit. finally im assuming u know that the script uve given isnt a php script but rather just the input form which means that my7Results.php file will probaly be the php script which processes the forms information

Hope that helps


Link to comment
Share on other sites

What ssinghuk said makes sense but will most likely stop the poll system from registering the actuall user responses.

Since the form is posted to myResults.php it seems more than likely that the myResults.php file updates the database with the user response and then displays the Overall results.

IF you do decide to do this


then you will need to make sure that the database is updated in your current page where the actual form is. Then you may decide to have a link that the user can click to display the overall results or Redirect them automatically after a set period of time.

Link to comment
Share on other sites

  • 2 months later...

If you get rid of the parameter in the action, then the script will not take into account the users vote.


will not work because then how will the submitted results get processed and increment the vote count ?

I would modify the myResults.php page so that the results are not displayed in that, and only the vote is added to the total vote count.

Link to comment
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...