473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

voting ballot in php

1
Hello!

I don't know how to get the data in the database that shows in the radio button. This is my code:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $server = 'localhost';
  3. $user = 'root';
  4. $password = '';
  5. $database = 'ssgelectionsystem';
  6. $con = mysql_connect ($server,$user,$password);
  7. $db = mysql_select_db($database);
  8.  if (!$db || !$con)
  9.  {
  10.      die ('<h3>SERVER DOWN BE BACK LATER</h3>');
  11.  }
  12.  else
  13.  {
  14.     if (isset($_POST['save'])) {
  15.  
  16.     $selected_radio = $_POST['position'];
  17.  
  18.     if ($selected_radio == 'name') {
  19.     $name_status = 'checked';
  20.    }
  21.     else if ($selected_radio == 'name'){
  22.     $name_status = 'checked';
  23.    }
  24.  }
  25.  } 
  26.  
  27. ?>
  28. <form name ="form1" method ="Post" action="radioButton.php">
  29.     <table border="0" align ="">
  30.     <td>President</td>   
  31.     </table>
  32.  
  33.          <td><input type="radio" name="name" size="30"></td>  
  34.          <?php
  35.          $query="SELECT* FROM can_reg";
  36.          $result=  mysql_query($query);
  37.          while($record=  mysql_fetch_array($result))
  38.          {
  39.              echo"<option>{$record['name']}</option>";
  40.  
  41.          }
  42.          ?>
  43.  
  44.     <tr>
  45.         <td></td>
  46.          <td><input type="submit" name="save" value="SUBMIT"></td>
  47.     </tr>
  48. </form>
------------------------------------------------------
the result is 1 radio button in 2 names....
Sep 9 '11 #1
0 1145

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Alan Dechert | last post by:
A couple of months ago, I posted a call for volunteers on C.L.PY for our demo voting system development project (open source Python on SourceForge). I am very pleased with the result so far. We...
9
by: PiedmontBiz | last post by:
Listening to National Public Radio while reading comp.lang.python. What a life! I just heard a piece on NPR about the security failures of an electronic voting system being developed. I know a...
68
by: Marco Bubke | last post by:
Hi I have read some mail on the dev mailing list about PEP 318 and find the new Syntax really ugly. def foo(x, y): pass I call this foo(1, 2), this isn't really intuitive to me! Also I...
10
by: windandwaves | last post by:
Hi Folk I am developing a voting / polling system. Eg. Who is your favourite sport star: a. mike b. sara c. frank
1
by: AES | last post by:
Can anyone point to software or HTML code (preferably shareware or modest cost, preferably Mac or PC based) that would permit a small organization to carry out a simple election with online voting...
5
by: george | last post by:
Hi All I've used couple of GPL/free voting scripts (some of these are very good), but need to create/find one that allows users to add a new answer. For example: This is a voting question -...
60
by: Eric | last post by:
I thought it might be fun to run a simple vote to discover the most preferred spacing style for a simple if statement with a single, simple boolean test. By my count, there are 32 possible...
0
by: Mike N. | last post by:
Hello I live in a condo community of about 500 people. We are electing a Board of Directors. There are 8 candidates for 4 openings. I am attempting to automate the vote counting process. I have...
10
by: Marek Zawadzki | last post by:
Hi all. Is it possible to implement an accurate voting mechanism (think digg.com) that does not require users to sign in before voting? I think for many people registering is pain and thus...
0
by: Mirce | last post by:
I have installed a phpBB2 forum at next URL: http://www.hcu.untz.ba This site is dedicated to handicapped persons. I have posted a poll at this site. The results of voting on poll questions are...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.