Xml/php voting system, help need!!

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Xml/php voting system, help need!!

  1. #1
    Join Date
    Nov 2008

    Xml/php voting system, help need!!

    Hi there, I'm creating a PHP/XML-based voting system. There are 24 options for a user to vote from, and ideally I'd like the user to see a picture of each person they vote for. So far, I've managed to list all the names of people up for voting from a "poll.xml" file in my "poll.php" file which is what web users will go to in order to vote. It also correctly updates the tally in the XML file when a person is voted for. The only thing that doesn't work now is trying to get an image to display next to each person's name...any ideas? Or would I have to learn XSLT to do this? (I have none currently, just a plain XML file and PHP file).

    Thanks for your time! Appropriate sections of each file are below

    PHP Code:
    function printVotingForm($pid) {
    // get these variables in this scope
    global $polls$header_file$footer_file;

    // include header file

    // print poll title and form
    echo "<h3 style=\"text-align: center\">" $polls->poll[$pid]['title'] . "</h3>\n";
    "<form action=\"" $_SERVER['PHP_SELF'] . "\" method=\"post\">\n";
    "<input type=\"hidden\" name=\"pid\" value=\"$pid\" />\n";
    "<ul style=\"list-style-type: none\">\n";

    // count number of answers
    $no_answers count($polls->poll[$pid]->answers->answer);

    // print each answer as a checkbox
    if ($polls->poll[$pid]->multipleanswers == "yes") {
            for (
    $i 0$i $no_answers$i++) {
    "<li><input type=\"checkbox\" name=\"vote[]\" value=\"" $polls->poll[$pid]->answers->answer[$i]->name "\" />" $polls->poll[$pid]->answers->answer[$i]->name "</li>\n";

    // print each answer as a radio button
    else {
            for (
    $i 0$i $no_answers$i++) {
    "<li><input type=\"radio\" name=\"vote\" value=\"" $polls->poll[$pid]->answers->answer[$i]->name "\" />" $polls->poll[$pid]->answers->answer[$i]->name "</li>\n";

    "<p style=\"text-align: center\"><input type=\"submit\" value=\"Vote\" /> or <a href=\"" $_SERVER['PHP_SELF'] . "?pid=$pid&view_results=1\">View Results</a></p>\n";

    // include footer file

    <?xml version="1.0"?>
    <poll title="Who do you think should win the vote this year?">

  2. #2
    Join Date
    Apr 2007
    Sterling Heights, Michigan
    Welcome to DevX

    I would image it would be something like
    <html:img src="http://somesite.com/someimage.jpg" />
    I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
    Please use [Code]your code goes in here[/Code] tags when posting code.
    Before posting your question, did you look here?
    Got a question on Linux? Visit our Linux sister site.
    Modifications Required For VB6 Apps To Work On Vista

Similar Threads

  1. Replies: 5
    Last Post: 05-27-2008, 11:17 AM
  2. voting / polling system
    By milsom in forum ASP.NET
    Replies: 2
    Last Post: 04-05-2008, 07:41 AM
  3. voting system
    By racerrunner in forum Java
    Replies: 1
    Last Post: 03-16-2006, 04:28 PM
  4. API For shutting, starting win NT,9x OSes
    By Saiful in forum VB Classic
    Replies: 6
    Last Post: 10-15-2000, 03:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center