[PHP] Re: PHP checkbox/hidden field question

2002-09-02 Thread Erwin

 I am executing the follwoing statement as part of a while loop.
 This is part of a form and I wish to pass the name and value of the
 checkbox as a hidden field only is the checkbox is checked. Can you
 suggest how I can accomplish this task?


 tdinput type=checkbox name=d_c_arr[] value=?php echo
 $db-f(order_id) ?/td

As you might know, checkboxes don't have the VALUE attribute. HTML won't
even submit the VALUE attribute to the next page. You will only have an
array containing 0's and 1's, the results of the checkboxes. So, on the next
page, you will have to lookup the values again.
Then print the hidden input's to the page in a for loop, while looping
trough $d_c_arr.

HTH
Erwin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] RE: PHP checkbox/hidden field question

2002-09-02 Thread Tim Ward

you need to define the key for checkbox arrays in order to distinguish them
(as only the checked ones will be posted)..
something like ...

tdinput type=checkbox name=d_c_arr[?php echo($count++); ?]/td


Tim Ward
www.chessish.com

 -Original Message-
 From: Paul Maine [mailto:[EMAIL PROTECTED]]
 Sent: 02 September 2002 00:56
 To: PHP PHP
 Subject: PHP checkbox/hidden field question
 
 
 I am executing the follwoing statement as part of a while 
 loop. This is
 part of a form and I wish to pass the name and value of the 
 checkbox as a
 hidden field only is the checkbox is checked. Can you suggest 
 how I can
 accomplish this task?
 
 
 tdinput type=checkbox name=d_c_arr[] value=?php echo
 $db-f(order_id) ?/td
 
 Thank You
 Paul
 php
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: PHP checkbox/hidden field question

2002-09-02 Thread Marek Kilimajer

You are wrong, this is from HTML 4.01 specification:

value = /cdata/ cid:[EMAIL PROTECTED] [CA] 
cid:[EMAIL PROTECTED]
This attribute specifies the initial value cid:[EMAIL PROTECTED] of
the control. It is optional except when the 
type cid:[EMAIL PROTECTED] attribute has the value radio or 
checkbox.

Upon submiting a form, only successfull checkboxes are submited,
so on the next page you only need this loop:

foreach($d_c_arr as $i) {
echo 'input type=hidden name=d_c_arr[] value='.
htmlspecialchars($i).'';
}

$d_c_arr contains only checked checkboxes.

Marek

Erwin wrote:

I am executing the follwoing statement as part of a while loop.
This is part of a form and I wish to pass the name and value of the
checkbox as a hidden field only is the checkbox is checked. Can you
suggest how I can accomplish this task?


tdinput type=checkbox name=d_c_arr[] value=?php echo
$db-f(order_id) ?/td



As you might know, checkboxes don't have the VALUE attribute. HTML won't
even submit the VALUE attribute to the next page. You will only have an
array containing 0's and 1's, the results of the checkboxes. So, on the next
page, you will have to lookup the values again.
Then print the hidden input's to the page in a for loop, while looping
trough $d_c_arr.

HTH
Erwin



  




RE: [PHP] Re: PHP checkbox/hidden field question

2002-09-02 Thread victor

Some check box info here too:

http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_20117420.html

- Victor  www.argilent.com

-Original Message-
From: Marek Kilimajer [mailto:[EMAIL PROTECTED]] 
Sent: Monday, September 02, 2002 7:24 AM
To: PHP
Subject: Re: [PHP] Re: PHP checkbox/hidden field question

You are wrong, this is from HTML 4.01 specification:

value = /cdata/ cid:[EMAIL PROTECTED] [CA]
cid:[EMAIL PROTECTED]
This attribute specifies the initial value
cid:[EMAIL PROTECTED] of
the control. It is optional except when the 
type cid:[EMAIL PROTECTED] attribute has the value
radio or checkbox.

Upon submiting a form, only successfull checkboxes are submited,
so on the next page you only need this loop:

foreach($d_c_arr as $i) {
echo 'input type=hidden name=d_c_arr[] value='.
htmlspecialchars($i).'';
}

$d_c_arr contains only checked checkboxes.

Marek

Erwin wrote:

I am executing the follwoing statement as part of a while loop.
This is part of a form and I wish to pass the name and value of the
checkbox as a hidden field only is the checkbox is checked. Can you
suggest how I can accomplish this task?


tdinput type=checkbox name=d_c_arr[] value=?php echo
$db-f(order_id) ?/td



As you might know, checkboxes don't have the VALUE attribute. HTML
won't
even submit the VALUE attribute to the next page. You will only have an
array containing 0's and 1's, the results of the checkboxes. So, on the
next
page, you will have to lookup the values again.
Then print the hidden input's to the page in a for loop, while looping
trough $d_c_arr.

HTH
Erwin



  


__ 
Post your ad for free now! http://personals.yahoo.ca

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Re: PHP checkbox/hidden field question

2002-09-02 Thread Erwin

Marek Kilimajer wrote:
 You are wrong, this is from HTML 4.01 specification:


You're right. Thanks for your reply!

Grtz Erwin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php