Radio Buttons/ Check Box Php/mysql

Dec 23, 2005

ok i want to create a page where i have a few groups of radio buttons and a few groups of check boxes, a computer configurator basically. i'm new to pgp/mysql but i'm sure i can get the result i want which is something like the alienware website.

i have product info in the database and need to create a page from that. should i generate the page using php and the database or should i manually code the html forms and then try add in the info? I need to get the product id, product description and price from the database. the script should then be able to total up the prices of the checked selection and display that.


Pulling MySQL Data For Check Boxes And Radio Buttons?

Apr 29, 2011

I have it so users can submit info to my site. They have to check some check boxes and radio buttons. I want them to be able to edit this information, so I want to have the data pulled from the MySQL database and have the correct radio button selected (and the text bolded). So I'm thinking some sort of array to check for each value in the database... but I don't really know.

There are a few groups of radio boxes and check boxes but here is an example of one.

Code: [Select] <input type="radio" name="stage" value="Stage 1" /> Stage 1
<input type="radio" name="stage" value="Stage 2" /> Stage 2
<input type="radio" name="stage" value="Stage 3" /> Stage 3


So when I pull information (lets say I want to echo it) it'd look like this:

Code: [Select]$row[STAGE]

The value for the stage selection can only be Stage 1, Stage 2 or Stage 3 so I need it to be selected when the page loads.

View 12 Replies View Related

Radio Buttons Not Check Properly

Feb 28, 2001

I'm using the code :

if (!isset($rSemester)){
$valid = "false";

$error_message .= "* Please choose at least one semester <br>" ;} rsemester is two radio buttons. why does this not check properly. am I missing any thing.

View 5 Replies View Related

Use Check Boxes Or Radio Buttons For Hacking?

Jul 7, 2010

I have lots of strings that I have to sanitize, and that's not a problem, but I have a few radio buttons and check boxes too. At first glance, it seems to me that there aren't any security holes with them that can be exploited, but I know from experience that kind of thinking can get me in trouble.

Does anyone know of a way a malicious user can use check boxes or radio buttons for hacking, and if so, how to block them?

View 10 Replies View Related

Submit Code Needs To Check Which One Radio Buttons Is Checked

Nov 23, 2005

I Have 2 radio buttons on my form, and they work 'together' so to speak,on goes on,the other off, the other goes on the other goes off.

To do this I made their values the same,But my submit code needs to check which one is checked. How do I do this?

View 1 Replies View Related

Declaring In Application Forms W/ Radio Buttons & Check Boxes To Save?

Jun 26, 2011

I'm really confused about how to start on my PHP with radio buttons and check boxes.How do I print out the option chosen by the user? Also, declaring lots of fields with similar name but with different answers.t also needs to be connected to a mySQL database.

View 2 Replies View Related

How To Use Radio Buttons To ID A Mysql Row

Feb 27, 2004

I've written a script that displays a list of names and puts a radio button next to the name. The idea is that a user can select the name and then press one of two buttons: delete or edit. A third add button with a text field would be available as well.

I'm having difficulty figuring out how to use the radio button's value to send a delete query. Here's what I have so far, and it is the last section --if($submit)--that doesn't work for me:

View 1 Replies View Related

Displaying Mysql Results Using Radio Buttons?

Feb 14, 2010

I have a script that displays mysql results within a table. Lets say that the table has a column named Holidays. On my page I have 4 radio buttons named, (X-Mas, Halloween, Easter, Thanksgiving). Right now the table displays all the results from the table. Is it possible to click on one of the radio buttons (lets say Halloween) and have the page refresh and only show results from the holidays column named Halloween? I could make separate pages for each radio button, but that is just way too many pages. I think I'm looking to change the mysql query depending on what radio button is checked. Is there a name for this operation?

View 3 Replies View Related

Set Mysql Values From Radio Buttons In Html Form?

May 10, 2011

I want two radio buttons on a webpage (written in php) representing "yes" and "no". When I load the page I want it to fetch a value from a mysql db and set the corresponding radio button. And when I click on the other button, I want it to update the database and reload the page.

if (!isset($_POST['submit'])) {
$sql = "SELECT challenge_me FROM contestants WHERE id=$id";
$res = (mysql_fetch_assoc(mysql_query($sql, $db)));
$challenge_me = $res["challenge_me"];


View 1 Replies View Related

Populate Radio Buttons And Checkboxes In HTML Form From MySQL

Nov 12, 2009

I have an HTML form that has all kinds of input elements - text, textarea, radio buttons and checkboxes.
I have no problem inserting or updating data in MySQL DB from the HTML form. But when I want to display what is already in the DB back on my HTML form, it displays the data that is in text and textarea, but not in radio buttons and checkboxes.

View 4 Replies View Related

Filtering An MySql Query By Radio Button / Check Box

Jun 28, 2010

I am redesigning my Football Clubs web site and want all the statistical side to be database driven. After struggling to get to grips with most of it I am currently resigned to putting them together in Excel and importing into the database via PHPMyAdmin just to get it up and running, but am struggling on some of the simpler points. I will only go through them one at a time though and can reassure everyone that I have searched high and low for the answers but am not sure exactly how the question needs to be asked ('using radio buttons to filter mysql query' is how I asked it), hence the fact that time is running out. So the first question (with apologies if it is not formatted/asked correctly!)......

I am running a query that shows a list of football matches that a player has featured in but want users to be able to choose what they actually see via a combination of radio buttons or check boxes. For example, if someone wanted to see only 'Home' matches that the player scored a goal in they could check those two buttons and the table will filter, preferably in the same page. The final form will have a lot more than that but I just want to get a grasp first! My query is Code: [Select]SELECT * FROM player_apps WHERE Player LIKE 'saund%' ORDER BY Year DESC, Month DESC, Day DESCThis one is for the page for a specific player (surname Saunders) And the 'call is Code: [Select] <?php do { ?>

<td><?php echo $row_Recordset3['Day']; ?>/<?php echo $row_Recordset3['Month']; ?>/<?php echo $row_Recordset3['Year']; ?></td>
<td><?php echo $row_Recordset3['H_A']; ?></td>
<td><?php echo $row_Recordset3['Opponent']; ?></td>
<td><?php echo $row_Recordset3['Comp']; ?></td>
<td><?php echo $row_Recordset3['WDL']; ?></td>
<td><?php echo $row_Recordset3['F']; ?> - <?php echo $row_Recordset3['A']; ?></td>
<td><?php echo $row_Recordset3['Type']; ?></td>

I need to do now is work out how to set it so that if the 'Home' radio button is checked it will only show records where the 'H_A' field has 'Home' in it, which I have found some code for elsewhere. However, if 'Home' and 'Scored' are both checked it would need to show records where the 'H_A' field has 'Home' in it and 'Goals' is >0. I am very new php and mysql but as I am under a very tight schedule to get this done I am doing it all the wrong way round but hopefully if I can get it all up and running, I can improve it at a later date.

View 1 Replies View Related

IF And Radio Buttons

Jul 17, 2005

I have the following code which connects to a database and sets the
value of counter to &#390;' and the date to be either the current date or a
users own date. The database connects via an included script as this is
a contribution for OSCommerce. Each section (the set date today and set
date custom) works fine by itself (with the other half commented out)
but I cant make it so the option is available via radio buttons, what am
I doing wrong?

P.S. This is the code I am using

//OS Commerce Counter Reset v0.15
//Author: Ben Allen

if ($submit) {
$flag="OK"; // This is the flag and we set it to OK
$msg=""; // Initializing the message to hold the error messages
//Set Query Variables
$query = "UPDATE counter SET counter = 0";
$today = date("Ymd");
$datetoday = "UPDATE counter SET startdate = $today";
//Set Date=Today
if ($setdate="true") {
$counterquery = mysql_query($query);
$datequery = mysql_query($datetoday);
echo "Counter Reset Succesfully";
//Set Date Custom
if ($setdate="false") {
//Edit Database:
$customdate = mktime(0, 0, 0, $month, $day, $year);
$datecustom = strftime("%Y%m%d", $customdate);
$datecustomquery = "UPDATE counter SET startdate = $datecustom";
$counterquery = mysql_query($query);
$datecustomresult = mysql_query($datecustomquery);
echo "Counter Reset Succesfully";...........

View 2 Replies View Related

Radio Buttons

Jul 11, 2003

I have a page which displays lots of input fields, text areas and radio buttons. When the submit button is pressed, a short bit of error checking happens, and if the form is not correct, the user is returned to it.

When returned, all the fields etc will contain the previously entered data so that the user can see where they went wrong. This is all well and good, except I can't see how to do this with the radio buttons - a/ is it possible, b/ how easy is it to do c/ suggestions on solutions? PHP Code:

View 2 Replies View Related

Radio Buttons?

Feb 21, 2006

trying to make a "User report" page.. and it has 3 radio buttons Code:

View 4 Replies View Related

Add The Value To Radio Buttons?

Dec 29, 2010

currently am developing my website for payment process. most probably i have completed my work on it. whats my question in my website finally i mentioned payment delivery details which has three radio buttons with values (in pounds).after customer clicks that those buttons the corresponding value should add with addcart and display the final amount. this is the web page i need http:[url]... am tottaly confusing what code should i apply on it.
can any one post me the correct code.

View 3 Replies View Related

Using Radio Buttons With SQL?

Dec 7, 2010

I have FlightSurvey.html, EnterFlightSurvey.php, and ShowSurveyResults.php When entering data, i cannot figure out how to get the radio buttons to be entered into the database... they don't show up on the 'surveys' table. Secondly, it tells me error #1064 when i press the submit button third, when I try to see 'past survey results" i get a bunch of undefined indexes for ShowSurveryResults.php for the radio button names- and they don't show up in the table. I've tried this a few different ways and nothing seems to be working.

HTML Code:
<h2> Tell us how we did! Enter your flight information and rate our services</h2>
<form method="POST" action="EnterFlightSurvey.php">
<p>Flight Date <input type="text" name="flight_date" /></p>
<p>Flight Time <input type="text" name="flight_time" /></p>
<p>Flight Number <input type="text" name="flight_number" /></p>


View 4 Replies View Related

Validate Radio Buttons

Apr 4, 2005

i am trying to create an PHP form that checks to see if a radio button as been selected before submitting information.

there are two radio buttons, and the user needs to pick one.

View 1 Replies View Related

Radio Buttons And Forms

Feb 23, 2001

I have a form with a series of records, each with a radio button. It's probibly very obvious, but I can't seem to figure out how to get that number when processing the form.
I know it's an array, but it seems like radio buttons don't quite work like check boxes.

View 4 Replies View Related

Radio Buttons And Use Of NULL

Apr 20, 2006

I am developing a survey that has a bunch of mainly radio buttons. The radio buttons are for selections Disagree Strongly through Agree Strongly which I have assigned values 1-5, and a N/A selection. If nothing is entered, or N/A is selected, I want NULL to be entered into the DB. For more information on this, read this thread: Here is the code:

View 14 Replies View Related

Dynamic Radio Buttons

Apr 6, 2007

My situation is that I have a form that asks the user for a number. Next, I execute a while loop that displays a group of questions the amount of times the customer entered. For instance, the loop looks this: Code:

View 7 Replies View Related

Radio Buttons Disabled

Mar 16, 2005

I am causing my radio buttons to be either checked or unchecked based on a data value. When the page loads the radio buttons are disabled and I can't unselect them. Code:

View 1 Replies View Related

Including Radio Buttons

Dec 13, 2005

im creating a online questionnaire where the results are mailed to me and i want to have 4 radio buttons in my form for whats there favourite colour, and the one selected will be put in my mail.php script, do you know the html code and php code for a radio button? also a quickie, if i wanted to include a 'continue further questions on next page' button is that a sql thing or can it be done using php formail?

View 6 Replies View Related

Radio Buttons In For Statement

Dec 29, 2006

Questions for the quizes are individual records in a db table. They can be in a multiple choice, fill in the blanks, modify statement or essay format.

When someone opens the test a select query pulls the questions and, depending on the question type, creates a form field for each question using a for statement. Code:

View 7 Replies View Related

Checked Radio Buttons

Jul 5, 2007

I'm trying to check a radio button based on data in the mysql database. Code:

View 2 Replies View Related

Read Only Radio Buttons

Feb 5, 2007

Im currently using the code below to show the value of a database field. How can i make the radio buttons read only so the customers cant change it. Code:

View 3 Replies View Related

Radio Buttons Issue

Jan 12, 2007

I'm hoping someone can help me out with an issue I'm having with another PHP form. The form I'm trying to create has a number of questions with three responses - Yes, No, and N/A. For some strange reason my form will not allow radio buttons to operate like they have in the past for me with PHP forms.

For example, to get the form to work I have to give each Yes, No, and NA its own name in order for the "echo" command to work. Below is a snippet of the HTML and PHP code I'm using. Code:

View 1 Replies View Related

Adding Radio Buttons

Apr 28, 2006

echo '<table align = "center" border = "1" cellspacing = "0" cellpadding = "5">
<td align="left"><b>Type</b></td>
<td align="left"><b>Sleeps</b></td>
<td align="left"><b>Board</b></td>
<td align="left"><b>Description</b></td>
<td align="left"><b>Pets Allowed</b></td>

while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo '
<td align="left">'. $row['type']. '</td>
<td align="left">'. $row['sleeps']. '</td>
<td align="left">'. $row['board']. '</td>
<td align="left">'. $row['description']. '</td>
<td align="left">'. $row['pets_allowed']. '</td>

View 1 Replies View Related

Calculation With Radio Buttons?

Feb 5, 2010

i am having a problem here with PHP (Brand new in this area. My table is as follows:


What i am trying to do is, a) For Play_1, user will choose First or Second. If the user choose First then on the right side into the textarea (first row, last column) automatically value 10 will appear. Or if the user choose second then on the right side into the textarea (first row, last column) automatically value 5 will appear. b) For Play_2, it will work just like Play_1 c) Finally, the code will get the main two values of Play_1 and Play_2 (last column, two rows), sum them up and present the Total in the Total textarea. The code i have written is as follows, which is for sure not running:


View 5 Replies View Related

How To Get Status Of Radio Buttons

Dec 19, 2010

how can I get the status of radio buttons based on their value in the database? I want to set them to either checked or unchecked based on their respective values in the database. field_type is int(1 or 0). Is there a more efficient way to do this?

$news_alert_status_a = "unchecked";
$news_alert_status_k = "unchecked";
$news_alert_status_n = "unchecked";
$events_alert_status_a = "unchecked";
$events_alert_status_k = "unchecked";


View 2 Replies View Related

Set The Value For Radio Buttons When Edit?

Jun 1, 2011

I have a Gender Row with radio buttons male & female. when i register as first time the values of radio button will store in database. Now my question is if i edit that row again it want to come(that means checked) with that value as male/female. how to make it?

HTML Script :
<tr id="inside">
<td align="right" width="40%" id="side" >Gender</td>
<td width="3%"> </td>
<td align="left" width="50%">
<input type="radio" name="sex" value="Male" size="17">Male
<input type="radio" name="sex" value="Female" size="17">Female

View 2 Replies View Related

Posting Via Radio Buttons

Mar 24, 2010

I having a bit of bother trying to post my values to another page using radio buttons. I have an exisiting form that I wanted to add the below code to. The form currently posts comments however I want it to post ratings of DVD's on the site. The error I am getting is: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in.. The error occurs on the first line of my code.

<input name="rating" type="radio" value="1" <?php if ($rating==1) echo "checked"?>>1
<input name="rating" type="radio" value="2" <?php if ($rating==2) echo "checked"?>>2
<input name="rating" type="radio" value="3" <?php if ($rating==3) echo "checked"?>>3
<input name="rating" type="radio" value="4" <?php if ($rating==4) echo "checked"?>>4
<input name="rating" type="radio" value="5" <?php if ($rating==5) echo "checked"?>>5

View 1 Replies View Related

How To Validate Radio Buttons

Oct 20, 2009

I have some problems with radio buttons.Here's the html:

<?php while($row=mysql_fetch_array($result)) { ?>
<input name="replacement" id="replacement" type="radio"
value="<?php echo $row['date']; echo $row['title']; ?>"

I need to validate if none of the radio buttons is checked using javascript.

View 2 Replies View Related

Update Two Radio Buttons?

Dec 12, 2010

I'm having truble to update my profile page that has two radio buttons for gender selection, one for male and the other for female, I've got the update function to work based on the selection, how to update the radio button so that once a user returns to their profiles page, the correct selected radio button would be selected, instead now both appear un-selected. Here's my code.

PHP Code:
$male_status = 'unchecked';
$female_status = 'unchecked';[code]....

View 6 Replies View Related

Radio Buttons - Get Choice?

Apr 25, 2010

I'm trying to create them dynamically (which i can do without any problems) but now i'm not sure how to get the information of which button was selected.


View 1 Replies View Related

Radio Buttons Not Echoing?

Oct 4, 2008

I am trying to build a form to record attendance for a group I am in. I am using radio buttons for Y or N. In my db each member is marked Y for each week as default.I want to only record the absences. My current form is echoing all the data correctly except the radio buttons, but I used the same radio button echo in a form that looks at individual data with success.Here is my code:

$host="*******"; // Host name
$username="***"; // Mysql username[code]....

View 7 Replies View Related

Showing All Of My Radio Buttons In Php.

Sep 28, 2007

I am having  an issue showing all of my radio buttons in php. I want it to read all of the different options from the database and put them all as Radio Buttons.. I can do it with a list but not with the bottons. Code:

View 9 Replies View Related

Using Hyperlinks Instead Of Radio Buttons?

Feb 12, 2011

I have the below code which pulls pet types from the database, and when you pick the particular type by selecting a radio button amd press 'Select Pet Type' you are brought to a page listing all examples of that pet. Is there any way of changing this so the pet types are listed as hyperlinks instead and when you click each particular hyperlink you are brought to a page where that pet type is listed?

/* Program: PetCatalog.php
* Desc:    Displays a list of pet categories from the
PetType table. Includes descriptions.
*          Displays radio buttons for user to check.


View 10 Replies View Related

Making Radio Buttons Sticky

Mar 21, 2005

My new form challenge I'm facing is preserving my checked radio buttons after form validation and, checking the appropriate button when information is retrieved from mysql dB.

I (with lots of help) was able to get all of the above working for an array of checkboxes but, I cannot use the same method for the radio buttons (I was able to call and display them dynamically but, that didn't seem to help. Here's the code I'm strugling with:

<label>( National Touring
<input type="radio" name="touring" value="National Touring"></label>)
<label>( Regional Touring
<input type="radio" name="touring" value="Regional Touring"></label>)
<label>( Market-based
<input type="radio" name="touring" value="Market-Based"></label>)
<label>( Other
<input type="radio" name="touring" value="Other"></label>)

Can anybody teach me how this can be done?

View 1 Replies View Related

Changing Radio Buttons To Dropdowns...

Sep 20, 2003

i need to change these radio buttons into dropdowns, can someone please get me started so i can see what needs to be done? PHP Code:

View 2 Replies View Related

Inserting Values Using Radio Buttons

Jun 20, 2002

I've got a contact form in which the user can add upto 12 contacts. On the form I have a radio button for each contact in which they can select whether he or she is in charge of subscritpions.

The problem I'm having is that if you enter 2 contacts with one of the radio buttons selected it inserts into the database with 'yes' next to the sub field but if they don't then it still prints 'yes'. PHP Code:

View 7 Replies View Related

Radio Buttons User Click Add 1

Jul 8, 2003

I am trying to make a poll, but I can't get it to work at all. I'm trying to, when the user clicks on the radio button, add 1 to the total for the one they clicked on.

View 2 Replies View Related

Saving Values Of Radio Buttons

May 16, 2002

I am making a survey and all answers are in radio buttons. I am making it with error checking by parsing it with $PHP_SELF. If someone skips an answer, I want it to refresh the form with all of the original entered values.

For a text field, I just do value=$value. However, I am not sure how to do it with radio buttons so info/ideas is useful. Oh yea, just to add, there are 47 different sets of 4 buttons so I would like it to be at least a little clean/short. If not, I can live with it.

View 5 Replies View Related

Radio Buttons, Retrieving Data

Jul 11, 2003

i ahve a form that has values in form of radio buttons. depending on th value selected, next page is selected. This form if for housing services. This form is for advertisements for houses for rent. I also have a little feature for editinf the ads, wherein i bring back all the values form the database (for the add) and allow them to edit it.
Is there any way in which a radio button field can be selected using the vaue in database(mysql)??

e.g radio buttons fields for milk(value=1), beer(2),water(3). and then i submit, the database gets value 2 (i selected beer). Then i click the edit button then i shud have beer selected even though the default is milk, for any new user.

View 1 Replies View Related

On/off Midi File By Using Radio Buttons

Mar 15, 2007

i want to add a midi file to my pages and i want to put two radio
buttons so that on is on and the other is off so that the users can
start or stop the file playing by choosing one of the radio buttons,
but the problem is that i dont know how to do it.

does any body know how this could be done

View 6 Replies View Related

Can't Get The Radio Buttons To Work Correctly

May 14, 2006

I have made a simple online test using dreamweaver but I can't get the radio buttons to work correctly - I have included an attachment to help explain a little more.

I have a table with one row (one row per question) and five colums but then I use the 'repeat region' so on runtime I have a table with 5 rows for each of the five questions in the sql database. Code:

View 4 Replies View Related