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

following radio & hidden does not work..... help please.

dba
using the following code with a problem....

echo "<input type='hidden' name='member_id' value=\"{$row[0]}\">{$row[0]}";

echo "<input type='radio' name='member_name'
value=\"{$row[1]}\">{$row[1]}<br />";

The post_data.php program posts the following

member id is: 0009
member_name is: Ralph Jones
cccb_name is: Annexation Committee

Everything is ok but the member id. The number listed '0009' is the
number of the last name in the returned result. It is NOT the number
listed with Ralph Jones which is '0007'.

This works the same with a radio button or a select statement.
Any help will be appreciated.
Jun 2 '08 #1
6 2040
dba wrote:
using the following code with a problem....

echo "<input type='hidden' name='member_id'
value=\"{$row[0]}\">{$row[0]}";
echo "<input type='radio' name='member_name'
value=\"{$row[1]}\">{$row[1]}<br />";

The post_data.php program posts the following

member id is: 0009
member_name is: Ralph Jones
cccb_name is: Annexation Committee

Everything is ok but the member id. The number listed '0009' is the
number of the last name in the returned result. It is NOT the number
listed with Ralph Jones which is '0007'.

This works the same with a radio button or a select statement.
Any help will be appreciated.
I'm terribly sorry, my crystal ball is in the workshop. Maybe someone else's
crystal ball is working and they can see your code which produces this.
Jun 2 '08 #2
On Fri, 30 May 2008 23:45:47 +0200, Paul Lautman
<pa**********@btinternet.comwrote:
dba wrote:
>using the following code with a problem....

echo "<input type='hidden' name='member_id'
value=\"{$row[0]}\">{$row[0]}";
echo "<input type='radio' name='member_name'
value=\"{$row[1]}\">{$row[1]}<br />";

The post_data.php program posts the following

member id is: 0009
member_name is: Ralph Jones
cccb_name is: Annexation Committee

Everything is ok but the member id. The number listed '0009' is the
number of the last name in the returned result. It is NOT the number
listed with Ralph Jones which is '0007'.

This works the same with a radio button or a select statement.
Any help will be appreciated.

I'm terribly sorry, my crystal ball is in the workshop. Maybe someone
else's
crystal ball is working and they can see your code which produces this..
Ah, I was wondering why I didn't see the original post... Plonked because
of <news://48**********************@roadrunner.com>. Ah well, something
less to do for me :)
--
Rik Wasmus
....spamrun finished
Jun 2 '08 #3
On Fri, 30 May 2008 23:45:47 +0200, Paul Lautman
<pa**********@btinternet.comwrote:
dba wrote:
>using the following code with a problem....

echo "<input type='hidden' name='member_id'
value=\"{$row[0]}\">{$row[0]}";
echo "<input type='radio' name='member_name'
value=\"{$row[1]}\">{$row[1]}<br />";

The post_data.php program posts the following

member id is: 0009
member_name is: Ralph Jones
cccb_name is: Annexation Committee

Everything is ok but the member id. The number listed '0009' is the
number of the last name in the returned result. It is NOT the number
listed with Ralph Jones which is '0007'.

This works the same with a radio button or a select statement.
Any help will be appreciated.

I'm terribly sorry, my crystal ball is in the workshop. Maybe someone
else's
crystal ball is working and they can see your code which produces this..
Hmmm, reading the original post, doing some crystal balling, the OP
doesn't get what the difference between hidden inputs & radio's are.
Default UA behvior is to send the last value of an hidden input with the
same name, and only the selected radio button. One cannot expect a
different hidden input to be sent just solely based on a different radio
being selected.

Damn you Paul, for bringing a nicely plonked post to my attention, and
damn me for the addiction to still need to answer it... That's it, no more
usenet for me today, a beer & a movie it is.
--
Rik Wasmus
....spamrun finished
Jun 2 '08 #4
dba
Do not understand your reply. Default UA behavior? is to send the last value of a hidden input with
the same name? and only the selected radio button?

The code is working fine with the following exception. The query is bring back member_id
member_fname and member_lname. The query concatenates the fname and lname but I also need the
member_id with the (radio button or select statement). I was trying to get the member_id using the
hidden input but can not get it to work.

Rik Wasmus wrote:
On Fri, 30 May 2008 23:45:47 +0200, Paul Lautman
<pa**********@btinternet.comwrote:
>dba wrote:
>>using the following code with a problem....

echo "<input type='hidden' name='member_id'
value=\"{$row[0]}\">{$row[0]}";
echo "<input type='radio' name='member_name'
value=\"{$row[1]}\">{$row[1]}<br />";

The post_data.php program posts the following

member id is: 0009
member_name is: Ralph Jones
cccb_name is: Annexation Committee

Everything is ok but the member id. The number listed '0009' is the
number of the last name in the returned result. It is NOT the number
listed with Ralph Jones which is '0007'.

This works the same with a radio button or a select statement.
Any help will be appreciated.

I'm terribly sorry, my crystal ball is in the workshop. Maybe someone
else's
crystal ball is working and they can see your code which produces this.

Hmmm, reading the original post, doing some crystal balling, the OP
doesn't get what the difference between hidden inputs & radio's are.
Default UA behvior is to send the last value of an hidden input with the
same name, and only the selected radio button. One cannot expect a
different hidden input to be sent just solely based on a different radio
being selected.

Damn you Paul, for bringing a nicely plonked post to my attention, and
damn me for the addiction to still need to answer it... That's it, no
more usenet for me today, a beer & a movie it is.
Jun 2 '08 #5
On Fri, 30 May 2008 20:00:51 -0500, dba wrote:
Do not understand your reply. Default UA behavior? is to send the last
value of a hidden input with the same name? and only the selected
radio button?
In short, it's an HTML problem. Essentially, if you send of a form

<input type="hidden" name="my_field" value="1">
<input type="hidden" name="my_field" value="2">
<input type="hidden" name="my_field" value="3">

your $_POST results will show my_field == 3. Even interlacing a radio
button set with those like

<input type="radio" name="my_set" value="1">
<input type="hidden" name="my_field" value="1">
<input type="radio" name="my_set" value="2">
<input type="hidden" name="my_field" value="2">
<input type="radio" name="my_set" value="3">
<input type="hidden" name="my_field" value="3">

will have absolutely no effect on the valye of my_field, because there
is no way to really associate the hidden inputs with the radio inputs.
They're entirely separate controls.

There's two ways to resolve this: an html way and a php way. The html
way is to make each of the hidden fields DIFFERENT from the others, like

<input type="hidden" name="my_field_set1" value="1">
<input type="hidden" name="my_field_set2" value="2">
<input type="hidden" name="my_field_set3" value="3">

which then becomes

<input type="radio" name="my_set" value="1">
<input type="hidden" name="my_field_set1" value="1">
<input type="radio" name="my_set" value="2">
<input type="hidden" name="my_field_set2" value="2">
<input type="radio" name="my_set" value="3">
<input type="hidden" name="my_field_set3" value="3">

when you interlace, and you make your form processor look at the value
of my_field_set1, my_field_set2, or my_field_set3 depending on the value
of my_set.

The php way is that instead of sending out the hidden fields at all, you
save them in the session data, then pull them back out when the form is
processed, based on the value of my_set, almost exactly like the last
part of the html method. This way of doing things is probably better,
all things otherwise being equal, because it prevents the value of your
hidden field from being seen, corrupted, or otherwise invalid.
The code is working fine with the following exception. The query
is bring back member_id member_fname and member_lname. The query
concatenates the fname and lname but I also need the member_id with
the (radio button or select statement). I was trying to get the
member_id using the hidden input but can not get it to work.
The query's fine, What you're missing is a bit of understanding of how
THE BROWSER (the UA -- user agent) manages form data. Which is why it's
an HTML question in the first place.

--
52. I will hire a team of board-certified architects and surveyors to
examine my castle and inform me of any secret passages and abandoned
tunnels that I might not know about.
--Peter Anspach's list of things to do as an Evil Overlord
Jun 2 '08 #6
dba
Mr. Coffin,

Thank you for a great answer and some fine pointers. Will be trying some of your
ideas immediately.

Again, thank you very much.
Peter H. Coffin wrote:
On Fri, 30 May 2008 20:00:51 -0500, dba wrote:
>Do not understand your reply. Default UA behavior? is to send the last
value of a hidden input with the same name? and only the selected
radio button?

In short, it's an HTML problem. Essentially, if you send of a form

<input type="hidden" name="my_field" value="1">
<input type="hidden" name="my_field" value="2">
<input type="hidden" name="my_field" value="3">

your $_POST results will show my_field == 3. Even interlacing a radio
button set with those like

<input type="radio" name="my_set" value="1">
<input type="hidden" name="my_field" value="1">
<input type="radio" name="my_set" value="2">
<input type="hidden" name="my_field" value="2">
<input type="radio" name="my_set" value="3">
<input type="hidden" name="my_field" value="3">

will have absolutely no effect on the valye of my_field, because there
is no way to really associate the hidden inputs with the radio inputs.
They're entirely separate controls.

There's two ways to resolve this: an html way and a php way. The html
way is to make each of the hidden fields DIFFERENT from the others, like

<input type="hidden" name="my_field_set1" value="1">
<input type="hidden" name="my_field_set2" value="2">
<input type="hidden" name="my_field_set3" value="3">

which then becomes

<input type="radio" name="my_set" value="1">
<input type="hidden" name="my_field_set1" value="1">
<input type="radio" name="my_set" value="2">
<input type="hidden" name="my_field_set2" value="2">
<input type="radio" name="my_set" value="3">
<input type="hidden" name="my_field_set3" value="3">

when you interlace, and you make your form processor look at the value
of my_field_set1, my_field_set2, or my_field_set3 depending on the value
of my_set.

The php way is that instead of sending out the hidden fields at all, you
save them in the session data, then pull them back out when the form is
processed, based on the value of my_set, almost exactly like the last
part of the html method. This way of doing things is probably better,
all things otherwise being equal, because it prevents the value of your
hidden field from being seen, corrupted, or otherwise invalid.
>The code is working fine with the following exception. The query
is bring back member_id member_fname and member_lname. The query
concatenates the fname and lname but I also need the member_id with
the (radio button or select statement). I was trying to get the
member_id using the hidden input but can not get it to work.

The query's fine, What you're missing is a bit of understanding of how
THE BROWSER (the UA -- user agent) manages form data. Which is why it's
an HTML question in the first place.
Jun 2 '08 #7

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

Similar topics

3
by: KathyB | last post by:
Hi, I've tried everything I can think of. Using the script below, I thought on submit my ConfirmSave function would run, then if true returned, would run my form action. At this point it appears...
2
by: Christoph | last post by:
Is there any way you can trigger a function when the value of a hidden form element is changed? thnx, Christoph
3
by: Peter Aitken | last post by:
I am working on a VC++ program in VS.Net 2003. I am following the instructions in the help for putting a group of radio buttons on a form. 1) Put 3 radio buttons on the form. 2) Make sure they...
0
by: khawar | last post by:
radio buttons give error messages when programming using code-behind If you guys can help you will save my life help help help. following is the a.aspx file: <%@ Page Inherits="MyCodeBehind"...
1
by: | last post by:
The following code: Private Sub ClearControls(ByVal ctrl As Control) Dim i As Int32 For i = ctrl.Controls.Count - 1 To 0 Step -1 ClearControls(ctrl.Controls(i))
1
by: dhnriverside | last post by:
Hi I'm trying to create some JS to enable/disable some form elements when a radio button grp is set to a certain option. However, the Attributes.Add method does nothing... html.. ...
0
by: KjartanM-S | last post by:
Hi I've developed an application in VB.NET. I'm now trying to deploy it to another computer which has XP pro and .NET Framework 1.1 installed. I included a Setup & Deployment wizard project to...
4
by: Martin Fletcher | last post by:
I cant get the Concat function to work, please help. Here's some of my code. Module modTCP Public TCP_RECEIVED_DATA As String Private WithEvents TCP_SERVER As New WinSockSVR Private Sub...
3
by: musosdev | last post by:
Hi guys Okay, I've setup my projects to open and compile fine in VS2005 using FPSE and remote web, but it's *really* slow. So I thought I'd have a go at doing it the normal way, by loading from...
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?
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
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
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...
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...

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.