473,387 Members | 1,344 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,387 software developers and data experts.

How to save radio button data in a database and extract it?

Hello,

I'm designing a simple website for my football team where we can tell each other if we're able to play next weekend.

For this website I designed a page with radio buttons with the options: Attending, Not Attending, Unknown (standard option). But i'm not sure how to save the information from the radio buttons to the database and how to extract it again.

The code for the radio button page:
(Just for 2 players atm, will extend when I know how to complete the whole idea):
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9.  <p>Vink aan of je er bij bent of niet: </p>
  10.  <table width="600" border="0">
  11.    <tr>
  12.      <th scope="col">Naam</th>
  13.      <th scope="col">&nbsp;</th>
  14.    </tr>
  15.    <tr>
  16.      <td>Ale</td>
  17.      <td><form id="form2" name="form2" method="post" action="">
  18.          <label>
  19.            <input type="radio" name="Ale" value="Ja" id="Ale_0" />
  20.            Aanwezig</label>
  21.          <label>
  22.            <input type="radio" name="Ale" value="Nee" id="Ale_1" />
  23.            Afwezig</label>
  24.          <label>
  25.            <input type="radio" name="Ale" value="Geen" id="Ale_2" />
  26.            Onbekend</label>
  27.      </form></td>
  28.    </tr>
  29.    <tr>
  30.      <td>Andy</td>
  31.      <td><form id="form1" name="form1" method="post" action="">
  32.          <label>
  33.            <input type="radio" name="Andy" value="Ja" id="Andy_0" />
  34.            Aanwezig</label>
  35.          <label>
  36.            <input type="radio" name="Andy" value="Nee" id="Andy_1" />
  37.            Afwezig</label>
  38.          <label>
  39.            <input type="radio" name="Andy" value="Geen" id="Andy_2" />
  40.            Onbekend</label>
  41.      </form></td>
  42.    </tr>
  43.  </table>
  44.  <p>&nbsp;</p>
  45. </body>
  46. </html>
  47.  
My idea was that the people can change their options, press a save button and the view for the other players will be altered accordingly. I hope this is enough information, else just ask what you need :)
Nov 2 '10 #1
2 4181
dlite922
1,584 Expert 1GB
So what are you asking? You need to be able to connect to a database using PHP and parse the data from the page and insert it into the database.

Note, you have multiple people on the same page, what stops Ale from changing Andy's status?

There are tutorials online if you don't know how to use PHP to insert and update records in a database.

You'll need to know SQL as well.



Dan
Nov 5 '10 #2
Thanks for the reply dan, I know how to use SQL, just didn't know how to combine it with php as it's my first website with php, but i've fixed it already with using lists instead of radio buttons.

And for the multiple people on the same page, it's a page based on trust.
Nov 6 '10 #3

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

Similar topics

2
by: Renie83 | last post by:
Hi all! I was wondering does anyone have any ideas on how I can send info to a SQL database by choosing a radio button. What I want to do is set one radio button to "Max" and one to type "Avg"....
1
by: David | last post by:
Hi, May I know how to create data dynamically in a combo box after clicking on a radio button ? Data are retrieved using a store procedure from a SQL Server. For example : Click Radio Button...
4
by: Jay | last post by:
I have a form used to submit data (no surprises there!). I'd like to be able to populate the same form with previously submitted data. The data lives in a database once submitted and using ASP I...
6
by: Orchid | last post by:
I have 2 fields with Radio button Data Type, and both fields with more than one options. On Field1, I want the user to select option1, then Field2 is shown and able to select. If the user selects...
4
by: Hazzard | last post by:
What is the best way to do this? Binary with 0 representing off and 1 on? Int16 with 1 representing first button, 2 the second, 3 ... varchar with a character values at certain positions in the...
1
sanjay123456
by: sanjay123456 | last post by:
Dear Sir If i am working on sql.php and i am taking radio button forr option of question the i donot understand that when a user click any radio button then how i compre to answer ...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
2
by: puT3 | last post by:
I have Customer table where there is a field called Company Type which store corporate or private. I want to retrieve the value in the table so it is diplayed on classic asp file in radio button. Im...
1
by: pavithraj | last post by:
i m getting error. its not at all inserting into database.showing error like as below Notice: Undefined index: franchise_hours in...
2
by: Louloul | last post by:
I have an urgent question please if any one could answer me now coz my representetion for my project is tommorrow. this my code <html> <head> <title>Register</title> <script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.