Jump to content

PHP/MySQL poll script


HeyDudesWassup
 Share

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):

<TABLE BORDER=0 ALIGN=CENTER CELLPADDING=2 CELLSPACING=0 bordercolor="#003399">

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

<TR>

<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=>

<CENTER>

</CENTER>

</FORM></TD>

</TR>

</TABLE>

Link to comment
Share on other sites

VJKKVJKF

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



<FORM ACTION="" METHOD="POST">

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

VJKKVJKF

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

<FORM ACTION="" METHOD="POST">

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.

<FORM ACTION="" METHOD="post" >

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.

Guest
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.

Loading...
 Share

×
×
  • Create New...