Jump to content

Creating a Poll with Dreamweaver MX/PHP/MySQL


Recommended Posts

Hi, I've been looking for tutorials on how to create polls for about 3 hours now and have come up with only previously created scripts which I can't follow. I'm new to PHP, so any help with this is appreciated. Creating the HTML form is not a problem... but for other users it may be useful.

 

What I want to do is create a poll which sits underneith the navigation column of my website. It will have 2-5 radio button options, 1 vote per IP address (per day if possible). A submit button at the bottom. 1 option max per vote (can't select more than 1 button). When the user hits submit, the page re-loads, and displays the results in percentages with a horizontal orange bar for the leader, and horizontal blue bars for the others where the options had been previously.

 

What I'm hoping to get is a link to a step-by-step tutorial for accomplishing this using dreamweaver MX, or for some helpful, Godly person to write one up for me, though that's a bit of a long shot :D .

 

Thank you,

 

Tom Walker

CMG - Creative Marketing Group

t_walker84@msn.com

Link to comment
Share on other sites

I figgued out how one might go about this... it may not work, but I don't see why it wouldn't.

 

The gameplan is:

1)Create the form so that when it submits the url thing changes to say, url?vote=no

2)Some database ads 1 to its "no" variable, and 1 to its "total" variable.

3)We get 3 bits of data with something like $vote = $_REQUEST[database[no/yes/total]]; (I dunno how to do it)

4)We then make a graphic named "red_spacer.gif" and do something like:

<?php $yes_percent = $vote[yes]/$vote[total];

echo <img src="images/red_spacer.gif" width=$yes_percent>;

echo <img src="images/red_spacer.gif" width=$no_percent>; ?>

 

I think that might work. I just don't know how to code it, and I don't know how to make a database like that. I've only done those "company name, telephone number, etc." ones from tutorials with phpMyAdmin so far.

 

If any PHP/MySQL Wizz can cook up some code for me, it'd be much appreciated. I'd really like to actually learn how to do the database stuff though. If you could do a step-by-step thing for that, and then just cut/paste the php code (cuz I can probably figgure that out from analysis) it'd be appreciated. Thx.

Link to comment
Share on other sites

  • 4 months later...

It seems to have disappered into thin air. Looks like youre out of luck. It is easy howver to create your own with Dreamweaver. Just create a small dtabase with an id, num_votes, and rating colum. Snatch user ip and register it. Add 1 to number of votes. Add a rating value to rating and divide it by 2. It may be beneficial to create another table and log the voters ip and create a query to match the ip to the present day. This will help prevent flooding.

 

Show images with show image and base the condition on a numerical value or use a percentage calculation if you wish to use infinitly expabdable graphics.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.