Jump to content


Photo

Creating a Poll with Dreamweaver MX/PHP/MySQL


  • Please log in to reply
5 replies to this topic

#1 CMG

CMG
  • New Members
  • Pip
  • Newbie
  • 3 posts
  • LocationVictoria, BC Canada

Posted 15 March 2004 - 09:31 PM

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

#2 CMG

CMG
  • New Members
  • Pip
  • Newbie
  • 3 posts
  • LocationVictoria, BC Canada

Posted 16 March 2004 - 09:50 AM

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.

#3 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 22 March 2004 - 11:41 AM

easier solution is to visit the XM site and download a great little php poll extension.


#4 ikool

ikool
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 08 August 2004 - 12:00 AM

hello,

You could find a really great poll script Here is you could port it to dreamweaver would be very happy but if you can it works fine as it is.

:ph34r:

#5 FunkDOc

FunkDOc
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 11 August 2004 - 11:31 AM

Hello,

morpheus.100 would you please post the url for the poll extension.
I can't find neither xm's site nor bigmac's site.

Thanks for your help



#6 morpheus.100

morpheus.100
  • Members
  • PipPipPip
  • Advanced Member
  • 145 posts

Posted 12 August 2004 - 07:52 AM

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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users