473,403 Members | 2,366 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,403 software developers and data experts.

Radio Button - Reading Pre Selected Values from db

I am able to make a selection of information when entering a record, with
radio buttons giving the option of yes, or no.

Which stores their answer as yes, or no in the database. I then have an
update record page that reads information in the database, and presently it
will not retrieve the previously selected option from the database. I have
tried all sorts of if else statements, and can't get anything to work. I
want the previously selected option to be selected when they are entering
the update page. Thus, they have the option to change it, but want their
previous setting selected so they are aware of their currently selected
option is.

<td width="50%"> <input type="radio" name="ud_digdocs" value="Yes">Yes
<input type="radio" name="ud_digdocs" value="No" checked>No
Jul 16 '05 #1
2 9796
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Wed, 06 Aug 2003 16:36:05 GMT, "entoone"
<en*****@pacbell.net> amazingly managed to produce the following with
their Etch-A-Sketch:
I am able to make a selection of information when entering a
record, with radio buttons giving the option of yes, or no.

Which stores their answer as yes, or no in the database. I then
have an update record page that reads information in the database,
and presently it will not retrieve the previously selected option
from the database. I have tried all sorts of if else statements,
and can't get anything to work. I want the previously selected
option to be selected when they are entering the update page. Thus,
they have the option to change it, but want their previous setting
selected so they are aware of their currently selected option is.

<td width="50%"> <input type="radio" name="ud_digdocs"
value="Yes">Yes
<input type="radio" name="ud_digdocs" value="No" checked>No

$checked = ($db_stuff->option == 'Yes') ? 'checked="checked" ' '';
echo
'<input type="radio" name="ud_digdocs" value="No" ' . $checked .
'/>';
HTH.

Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPzFeTmfqtj251CDhEQIaQQCfQAdKBxvZvkMSfQ5al2Zr39 d6aFYAnjmA
DK3R7CB737+/+vJ8FLcHzM5A
=6DFI
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.
Jul 16 '05 #2
Thanks for the reply...

I found another example on the web while trying to still working on solving
this and Mark Baker had a post on another site that had a great example. So
the fix for me was.
<? $check0 = $check1 = "";
if ($digdocs == "Yes") { $check0 = " CHECKED"; } else { $check1 = "
CHECKED"; }
echo '<INPUT TYPE="RADIO" NAME="ud_digdocs" VALUE="Yes"'.$check0.'>Yes<BR>';
echo '<INPUT TYPE="RADIO" NAME="ud_digdocs" VALUE="No"'.$check1.'>No'; ?>

This allows the update page to read the values of the radio button, that is
presnetly stored in the database.

Thanks again!
"Ian.H [dS]" <ia*@WINDOZEdigiserv.net> wrote in message
news:uc********************************@4ax.com...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Whilst lounging around on Wed, 06 Aug 2003 16:36:05 GMT, "entoone"
<en*****@pacbell.net> amazingly managed to produce the following with
their Etch-A-Sketch:
I am able to make a selection of information when entering a
record, with radio buttons giving the option of yes, or no.

Which stores their answer as yes, or no in the database. I then
have an update record page that reads information in the database,
and presently it will not retrieve the previously selected option
from the database. I have tried all sorts of if else statements,
and can't get anything to work. I want the previously selected
option to be selected when they are entering the update page. Thus,
they have the option to change it, but want their previous setting
selected so they are aware of their currently selected option is.

<td width="50%"> <input type="radio" name="ud_digdocs"
value="Yes">Yes
<input type="radio" name="ud_digdocs" value="No" checked>No

$checked = ($db_stuff->option == 'Yes') ? 'checked="checked" ' '';
echo
'<input type="radio" name="ud_digdocs" value="No" ' . $checked .
'/>';
HTH.

Regards,

Ian

-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0

iQA/AwUBPzFeTmfqtj251CDhEQIaQQCfQAdKBxvZvkMSfQ5al2Zr39 d6aFYAnjmA
DK3R7CB737+/+vJ8FLcHzM5A
=6DFI
-----END PGP SIGNATURE-----

--
Ian.H [Design & Development]
digiServ Network - Web solutions
www.digiserv.net | irc.digiserv.net | forum.digiserv.net
Programming, Web design, development & hosting.

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Suzanne | last post by:
Hi, I have a form which our clients can fill in with their personal details. As part of the information we store there is a section - areas of interest - this is a number of radio buttons. ...
2
by: bbxrider | last post by:
i have 2 radio buttons 1 for yes and 1 for no, it is mandatory for one to be checked, and am purposely leaving both blank on the page when i tested for .value, when neither was checked, an alert...
2
by: jason | last post by:
The following (likely far from imperfect code), reports a value of NaN in the j4 display. I suppose the problem is I am not really passing the "checked" value of the radio button via .value ......
4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
3
by: ewitkop90 | last post by:
Here is my code: <SCRIPT> function transportchange(transport) { if (framenewinstall.Helpdesk.checked) framenewinstall.Helpdesk.checked=false; if (framenewinstall.CircuitNumber.checked)...
1
by: Rage Matrix | last post by:
Hi all, I have a small problem with Access radio button groups in VBA. I've got a radio button group called fraSearchMode with three radio buttons in it. At a certain point, I want to see which...
2
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and...
8
by: crayfiss | last post by:
Hi, firstly I am a total freshie in all this. From what I have gathered on the web and this forum, I finally managed to get my form up. I have a set of radio buttons with values to it and a select...
6
by: dba | last post by:
using the following code with a problem.... echo "<input type='hidden' name='member_id' value=\"{$row}\">{$row}"; echo "<input type='radio' name='member_name' value=\"{$row}\">{$row}<br />"; ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
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
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...
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.