Unless, of course, what you have is
name[], email[], sex[0]
name[], email[], sex[1]
name[], email[], sex[2]
Yep, that's exactly what I have.
If it's important to you that the indexes match across name[], email[] and
sex[], then you must supply
them explicitly for every field
Why do you? There's no reason you *have* to have consecutive indexes --
just iterate over the resulting array with foreach, and there's no
problem.
There is, the entries are grouped by its index. So, I group name[0],
email[0], and sex[0] as one. The problem if I don't maintain the index for
-Original Message-
From: leledumbo [mailto:leledumbo_c...@yahoo.co.id]
Sent: 10 August 2009 11:11
To: php-general@lists.php.net
Subject: RE: [PHP] Radio buttons problem
Why do you? There's no reason you *have* to have consecutive
indexes --
just iterate over the resulting
-Original Message-
From: leledumbo [mailto:leledumbo_c...@yahoo.co.id]
Sent: 10 August 2009 11:11
To: php-general@lists.php.net
Subject: RE: [PHP] Radio buttons problem
There is, the entries are grouped by its index. So, I group name[0],
email[0], and sex[0] as one
you will have to manually maintain the number in the bracket. but you
can try using a template engine like smarty, and use a for loop to
take care of the numbers in the brackets
Well.. the entries are inserted / deleted dynamically using JavaScript (to
avoid unnecessary refresh). Why can't it
you dont seem to understand how radio buttons work. they treat
name=sex[][] as a single group. and you can select only one element
in that group.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
-Original Message-
From: leledumbo [mailto:leledumbo_c...@yahoo.co.id]
Sent: 07 August 2009 05:43
This should work:
input type='radio' name='sex[1]' value='1'
input type='radio' name='sex[1]' value='2'
input type='radio' name='sex[2]' value='1'
input type='radio'
This should work:
input type='radio' name='sex[1]' value='1'
input type='radio' name='sex[1]' value='2'
input type='radio' name='sex[2]' value='1'
input type='radio' name='sex[2]' value='2'
Yes, that works. But should I manually maintain the number in the bracket?
Is there anyway so that
you will have to manually maintain the number in the bracket. but you
can try using a template engine like smarty, and use a for loop to
take care of the numbers in the brackets
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Mon, 03 Aug 2009 11:01:13 +0300, leledumbo leledumbo_c...@yahoo.co.id
wrote:
How can I make a radio button in one entry to behave independently from
the
one in another so that it can be accessed as name and email above?
This should work:
input type='radio' name='sex[1]' value='1'
Hi,
You solve the problem yourself: the radio input does show up once one
of the radios is checked. When it is unchecked is isn't set...if you
need to assign it a value in any circumstances you should test it with
?php $chkbox1 = (isset($_POST[radio_test])) ? true : false; ? for
example (of
That's because Radio Buttons and Check Boxes do not return anything if not
checked or selected.
So you gotta explicitly do it ur self. That is u gotta check for it's
validity and non-empiness.
e.g. in ur scenario
if(!isset($_POST['radio_test'])) { //print out all the options unselected }
else
{
Ashley M. Kirchner wrote:
I have this form.html:
form method=post action=form.php
text input input type=text name=input_testbr /
radio input1 input type=radio name=radio_test value=test1 /
radio input2 input type=radio name=radio_test value=test2 /
input type=submit value=Submit
/form
Then
None input type=radio checked name=radio_test value=None /
And if you didn't want it to show to the user (because they have to
make a choice anyway) . . . you can use this css:
input[value=None]
{
display: none;
}
You should then always have a value to play with in PHP, and the user
Justin Gruenberg wrote:
None input type=radio checked name=radio_test value=None /
And if you didn't want it to show to the user (because they have to
make a choice anyway) . . . you can use this css:
input[value=None]
{
display: none;
}
You should then always have a value to play with
[snip]
i have this code:
?if($old['Type']==Annual){?
input type=radio name=eventtype value=Annualchecked
accesskey=yYes
?}else {?
input type=radio name=eventtype value=OneTime checked
accesskey=nNo?}?
was just wondering if that was the right way to determine the state of a
radio button...?
if the
From: Andy B [EMAIL PROTECTED]
i have this code:
?if($old['Type']==Annual){?
input type=radio name=eventtype value=Annualchecked
accesskey=yYes
?}else {?
input type=radio name=eventtype value=OneTime checked
accesskey=nNo?}?
was just wondering if that was the right way to determine the
Assuming $old['Type'] somehow comes from $_REQUEST['eventtype'] (or is
related to it), then yeah, that'll work.
no its coming from a db result from fetch_array() of which im having an
interesting problem with right now but thats in another post
--
PHP General Mailing List (http://www.php.net/)
My understanding is if the variable exists then the radio button was
checked.
i have this code:
?if($old['Type']==Annual){?
input type=radio name=eventtype value=Annualchecked
accesskey=yYes
?}else {?
input type=radio name=eventtype value=OneTime checked
accesskey=nNo?}?
was just
- Original Message -
From: Daniel Clark [EMAIL PROTECTED]
To: Andy B [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, April 07, 2004 4:22 PM
Subject: Re: [PHP] radio buttons checked or not
My understanding is if the variable exists then the radio button was
checked.
i
he wants 3 radio buttons on a form .. something to the affect of:
input type=radio name=general value=this is a general
statement?this is a general post
input type=radio name=urgent value=this is an urgent
messagethis is an urgent post
input type=radio name=concern value=this is bothering
Using a case statment would be the easyest way to tell which one was
checked, but technicly one could check all three unless the value of name is
changed the same like ...
input type=radio name=priority value=this is a general
statement?this
is a general post
input type=radio name=priority
=postprayer.htmclick here/a
to go back to the form to re-enter your post.
/body
/html
?php
}
//finnish script here..
?
- Original Message -
From: Dennis Cole [EMAIL PROTECTED]
To: Sunfire [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Monday, February 24, 2003 1:29 AM
Subject: RE: [PHP] radio buttons
I don't think so,
Put the bracket with your radio's name not with your the value///
For example :
print td width=2input type=radio name=gl_acct[]
value=$row['acct']{$row['acct']}/td ...
and so one/
- Original Message -
From: David Jackson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent:
There is no reason to put brackets behind the name of the radio element. The brackets are neccessary for multi-select elements like checkboxes, but radio buttone are a single select element.
Your if statement should be a while loop.
I'm sure you don't want to set this ( value=acct[] ) as the
oups ... you're right !
- Original Message -
From: John Nichel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php [EMAIL PROTECTED]; David Jackson
[EMAIL PROTECTED]
Sent: Monday, November 04, 2002 2:57 PM
Subject: Re: [PHP] radio buttons from MySQL query?
There is no reason to put
PROTECTED]
Sent: Monday, November 04, 2002 2:57 PM
Subject: Re: [PHP] radio buttons from MySQL query?
There is no reason to put brackets behind the name of the radio element.
The brackets are neccessary for multi-select elements like checkboxes, but
radio buttone are a single select element
]
Sent: Monday, November 04, 2002 2:57 PM
Subject: Re: [PHP] radio buttons from MySQL query?
There is no reason to put brackets behind the name of the radio element.
The brackets are neccessary for multi-select elements like checkboxes,
but
radio buttone are a single select element.
Your
Just a hunch... but try value=1ndash;24 and see how that works, so
basically substitute - for ndash;
I can't see the rest of your code and what else you might be appending to
$msgtxt, so it could be something else...
Yes it was something else. I did a wrong comparison with the variable:
Actually it does explain it, you set the variable to false, which of course
is 0, so that's why you had a 0 :)
Also a good way of seeing if the variable is set, no equaling 0, , ,
false, etc is by using the empty function if (empty($empleados))
Glad you figured it out though!
Cheers
Rick
30 matches
Mail list logo