Could you try changing this:
if($groupTest != FALSE) {
to this:
if($groupTest !== FALSE) {
?
-Mensagem original-
De: Paul Halliday [mailto:paul.halli...@gmail.com]
Enviada em: quarta-feira, 24 de outubro de 2012 15:38
Para: PHP-General
Assunto: [PHP] Array help.
I am processing
]
Enviada em: quarta-feira, 24 de outubro de 2012 15:38
Para: PHP-General
Assunto: [PHP] Array help.
I am processing v4IP's and what I want to do is a prefix substitution if the
3rd octet matches a predefined list $groupMappings. I went down this path
and it isn't working as expected. Drawing
From: Paul Halliday [paul.halli...@gmail.com]
Sent: 24 October 2012 18:38
To: PHP-General
Subject: [PHP] Array help.
$groupMappings = array('40' ='A','41' ='B','1' ='C');
$ocTest = explode(., $ip);
$groupKeys = array_keys($groupMappings);
$groupTest = array_search
Ken Robinson kenrb...@rbnsn.com wrote:
At 08:50 PM 9/23/2012, Ron Piggott wrote:
I am wondering if there is a way to remove from
an array where the value is 0 (âzeroâ)
Array example:
$total_points_awarded = array( 1 = 17, 3 = 14, 4 = 0, 5 = 1, 6 =
0 );
In this example I would like to
I am wondering if there is a way to remove from an array where the value is 0
(“zero”)
Array example:
$total_points_awarded = array( 1 = 17, 3 = 14, 4 = 0, 5 = 1, 6 = 0 );
In this example I would like to remove element # 4 and # 6.
The “key” ( 1,3,4,5,6 ) represents the member’s account
At 08:50 PM 9/23/2012, Ron Piggott wrote:
I am wondering if there is a way to remove from
an array where the value is 0 (âzeroâ)
Array example:
$total_points_awarded = array( 1 = 17, 3 = 14, 4 = 0, 5 = 1, 6 = 0 );
In this example I would like to remove element # 4 and # 6.
The
Op 14 sep. 2012 07:51 schreef Adam Richardson simples...@gmail.com het
volgende:
On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs krebs@gmail.com
wrote:
Hi,
In PHP the array is in fact a hash map, but especially it is _used_ for
nearly everything map-, set-, ...-like thing. So in
On Fri, Sep 14, 2012 at 2:30 AM, Matijn Woudt tijn...@gmail.com wrote:
It doesn't need to be clunky.. just use array_flip and you've got the old
array again..
Well, array_flip has it's own potential issues (duplicate values are
lost, so my example of using zeros would not work.) I suppose I
On Wed, Sep 12, 2012 at 2:37 PM, Sebastian Krebs krebs@gmail.com wrote:
Hi,
In PHP the array is in fact a hash map, but especially it is _used_ for
nearly everything map-, set-, ...-like thing. So in short: The is no
operator or built-in function, that merges two arrays _and_ treat them
Hi,
In PHP the array is in fact a hash map, but especially it is _used_ for
nearly everything map-, set-, ...-like thing. So in short: The is no
operator or built-in function, that merges two arrays _and_ treat them
as set (instead of the hashmap, what they are). Your solution is the way
to
how can you explain someone in a simplest and everyday use example of ARRAY.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Sat, 2011-12-31 at 14:53 +0100, saeed ahmed wrote:
how can you explain someone in a simplest and everyday use example of ARRAY.
The manual page explains it pretty succinctly. I don't think you'll get
more simple than this, as there is obvious prerequisite knowledge
assumed (i.e. that you
how can you explain someone in a simplest and everyday use example of ARRAY.
The manual page explains it pretty succinctly. I don't think you'll get
more simple than this, as there is obvious prerequisite knowledge
assumed (i.e. that you know what a simple variable is, etc)
Hi saeed,
Ash
On Sun, Oct 30, 2011 at 08:47, Nam Gi VU nam.gi...@gmail.com wrote:
It is convenient to have a trailing comma when defining an array - so as
easy to add/remove code to add/remove an entry to the array
array(
'key00' = 'value00',
'key01' = 'value01',
'key02' = 'value02',
...
)
I have a class that takes as input, an array by reference and stores it in a
member variable. A method in this class later modifies the member variable
(which contains reference to the array). When I access the local variable
that was passed by reference to the constructor of this class object,
I have a class that takes as input, an array by reference and stores it in a
member variable. A method in this class later modifies the member variable
(which contains reference to the array). When I access the local variable
that was passed by reference to the constructor of this class object, I
-- Forwarded message --
From: Louis Huppenbauer louis.huppenba...@gmail.com
Date: 2011/10/31
Subject: Re: [PHP] Novice: PHP array by reference question (by C++
programmer)
To: Manish Gupta gman...@gmail.com
You have to assign the value by reference too
public function
It is convenient to have a trailing comma when defining an array - so as
easy to add/remove code to add/remove an entry to the array
array(
'key00' = 'value00',
'key01' = 'value01',
'key02' = 'value02',
...
)
I suggest to PHP Development team to make it available in the syntax to
On Sun, Oct 30, 2011 at 8:47 AM, Nam Gi VU nam.gi...@gmail.com wrote:
It is convenient to have a trailing comma when defining an array - so as
easy to add/remove code to add/remove an entry to the array
array(
'key00' = 'value00',
'key01' = 'value01',
'key02' = 'value02',
...
I am reading a csv file into an array. The csv file.
users.csv file contents:
w12345678,a
w23456789,b
w34567890,c
$csvfilename = users.csv;
$handle = fopen($csvfilename, r);
if($handle) {
The function fgetcsv() returns an array.
http://php.net/manual/en/function.fgetcsv.php
On Fri, Sep 9, 2011 at 9:00 AM, Marc Fromm marc.fr...@wwu.edu wrote:
I am reading a csv file into an array. The csv file.
users.csv file contents:
w12345678,a
w23456789,b
w34567890,c
On Fri, 2011-09-09 at 16:00 +, Marc Fromm wrote:
I am reading a csv file into an array. The csv file.
users.csv file contents:
w12345678,a
w23456789,b
w34567890,c
$csvfilename = users.csv;
$handle = fopen($csvfilename, r);
hi,
try to use print_r or var_dump to echo compound data type
You are echoing out an array. If you use something like print_r() or var_dump()
you will see the array elements
Thanks,
Ash
http://www.ashleysheridan.co.uk
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Marc Fromm marc.fr...@wwu.edu wrote:
I am reading a csv file into an
Dear List -
Here is a code snippet:
$bla = array(g1 = $results[7][6],
h1 = $results[7][7]);
print_r($bla);
$value = h1;
$locate1 = array_search($value, $bla);
echo This is locate ; print_r($locate1);
if(in_array($value, $bla)) print_r($bla);
Hi,
I'm new to php and i'm looking to setup an array (or what work best) of codes
and corresponding error strings, for example (pseudo code):
ERROR_CODES = array('-1' = 'Error opening file', '-2' = 'General File IO
Error', '-3' = 'Database connection error');
Access these string values using
On Feb 19, 2011, at 6:38 PM, Yogesh wrote:
I have two forms. One form helps read an input file into an array.
And the
other form needs this array as an input.
I am able to read the input file into an array, but how do I pass it
over to
the other form.
Both forms have PHP file as 'action'.
Hi Tamara,
I don't entirely understand this; Dan Brown gave you solution to use curl to
pass the array to the second form (do you mean script here?). That would
certainly work, but I'm wondering if it wouldn't be more secure to spool out
the array to a file from the first script after it has
On Feb 20, 2011, at 10:51 AM, Yogesh wrote:
I don't entirely understand this; Dan Brown gave you solution to use
curl to pass the array to the second form (do you mean script
here?). That would certainly work, but I'm wondering if it wouldn't
be more secure to spool out the array to a
Hello,
I have two forms. One form helps read an input file into an array. And the
other form needs this array as an input.
I am able to read the input file into an array, but how do I pass it over to
the other form.
Both forms have PHP file as 'action'.
Please help. Thanks
- Yogesh
On Sat, Feb 19, 2011 at 19:38, Yogesh yogesh...@gmail.com wrote:
Hello,
I have two forms. One form helps read an input file into an array. And the
other form needs this array as an input.
I am able to read the input file into an array, but how do I pass it over to
the other form.
Both
POST
On Sat, Feb 19, 2011 at 9:44 PM, Daniel Brown danbr...@php.net wrote:
On Sat, Feb 19, 2011 at 19:38, Yogesh yogesh...@gmail.com wrote:
Hello,
I have two forms. One form helps read an input file into an array. And
the
other form needs this array as an input.
I am able to read
On Sat, Feb 19, 2011 at 21:50, Yogesh yogesh...@gmail.com wrote:
POST
Use cURL, look into curl_setopt(), and add square brackets (and
optional key names) to your array. A quick start:
?php
$ch = curl_init();
curl_setopt(CURLOPT_POST,1);
Paul M Foster wrote:
[snip]
Shawn, I don't know if I have a good reason, other than I rather like
working with string vars instead of array vars from $_REQUEST for
(sticky forms and conditionals). I can check/verify them as well in the
process.
You should probably get used to dealing with the
Donovan Brooke wrote:
[snip]
if ($t_ok) {
}
Small correction.. with my established naming convention.. the above
ideally would be:
if ($b_ok) {
}
D
--
D Brooke
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hello again!
I'm trying to find a good way to convert array key/value's to
variable name values... but with the caveat of the name being
slightly different than the original key
(to fit my naming conventions).
first, I (tediously) did this:
---
if (isset($_GET['f_action'])) {
$t_action =
On Thursday 20 January 2011,
Donovan Brooke li...@euca.us wrote:
Hello again!
I'm trying to find a good way to convert array key/value's to
variable name values... but with the caveat of the name being
slightly different than the original key
(to fit my naming conventions).
first, I
On Thu, Jan 20, 2011 at 2:28 PM, Donovan Brooke wrote:
Hello again!
I'm trying to find a good way to convert array key/value's to
variable name values... but with the caveat of the name being
slightly different than the original key
(to fit my naming conventions).
first, I (tediously) did
On Thu, Jan 20, 2011 at 3:09 PM, Tommy Pham tommy...@gmail.com wrote:
On Thu, Jan 20, 2011 at 2:28 PM, Donovan Brooke wrote:
Hello again!
I'm trying to find a good way to convert array key/value's to
variable name values... but with the caveat of the name being
slightly different than the
Tommy Pham wrote:
[snip]
foreach ($_REQUEST as $key = $value) $$key = $value;
short-circuited one-liners :)
Regards,
Tommy
akk... wrong clicked before I had a chance to fix the code. anyway,
foreach ($_GET as $key = $value) if (substr($key, 0, 2) == 'f_')
${'t_'.substr($key, 2)} =
-Original Message-
From: Donovan Brooke [mailto:li...@euca.us]
Sent: Thursday, January 20, 2011 3:29 PM
Cc: php-general@lists.php.net
Subject: Re: [PHP] array to var - with different name
Tommy Pham wrote:
[snip]
foreach ($_REQUEST as $key = $value) $$key = $value;
short
On 12 January 2011 20:23, sono...@fannullone.us wrote:
Thanks for all the responses to my suggestion. I realize this would be a
major change, so that's why I also mentioned it as an addition to the
language.
I'm sure it's just what you're used to, but still being new to all this, it
On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling rquadl...@gmail.comwrote:
The Hungarian Notation [1] was what I was taught all those years ago
when I learnt standard C programming.
I learned it early on as well, and I never really liked it. Instead of
$iFish I would prefer a more
On Thu, Jan 13, 2011 at 12:59 PM, David Harkness
davi...@highgearmedia.com wrote:
On Thu, Jan 13, 2011 at 2:23 AM, Richard Quadling rquadl...@gmail.comwrote:
The Hungarian Notation [1] was what I was taught all those years ago
when I learnt standard C programming.
I learned it early on as
On Thu, Jan 13, 2011 at 10:07 AM, David Hutto smokefl...@gmail.com wrote:
On Thu, Jan 13, 2011 at 12:59 PM, David Harkness
I learned it early on as well, and I never really liked it. Instead of
$iFish I would prefer a more descriptive name such as $fishCount.
What info did you get on hook
I'd like to make a suggestion for a change, or possibly an addition, to the PHP
language.
I'm learning PHP and have been very excited with what it can do in relation to
HTML. But when I got to the part about arrays, I was disappointed to see that
they are designated with a $ the same as other
sono...@fannullone.us wrote:
I'd like to make a suggestion for a change, or possibly an addition,
to the PHP language.
I'm learning PHP and have been very excited with what it can do in
relation to HTML. But when I got to the part about arrays, I was
disappointed to see that they are
sono...@fannullone.us wrote:
I'd like to make a suggestion for a change, or possibly an addition, to the PHP
language.
I'm learning PHP and have been very excited with what it can do in relation to
HTML. But when I got to the part about arrays, I was disappointed to see that
they are
On Wed, 2011-01-12 at 11:45 -0800, sono...@fannullone.us wrote:
I'd like to make a suggestion for a change, or possibly an addition, to the
PHP language.
I'm learning PHP and have been very excited with what it can do in relation
to HTML. But when I got to the part about arrays, I was
On Jan 12, 2011, at 3:28 PM, Ashley Sheridan wrote:
If you check out the manual pages for those functions as well, you'll
see other related functions. I must say, of any language I've used, the
php.net documentation is by far the best, giving plenty of information
and user comments too. It's
On Wed, Jan 12, 2011 at 14:45, sono...@fannullone.us wrote:
I'd like to make a suggestion for a change, or possibly an addition, to the
PHP language.
I'm learning PHP and have been very excited with what it can do in relation
to HTML. But when I got to the part about arrays, I was
On Wed, Jan 12, 2011 at 12:37 PM, Daniel Brown danbr...@php.net wrote:
The @ is an error control operator, used to buffer the output and
store it in a variable - $php_errormsg. There's no way that would be
changed to become an array designator (though that doesn't mean your
idea itself is
On Wed, Jan 12, 2011 at 15:41, Michael Shadle mike...@gmail.com wrote:
On Wed, Jan 12, 2011 at 12:37 PM, Daniel Brown danbr...@php.net wrote:
The @ is an error control operator, used to buffer the output and
store it in a variable - $php_errormsg. There's no way that would be
changed to
Ashley Sheridan wrote:
On Wed, 2011-01-12 at 12:23 -0800, sono...@fannullone.us wrote:
Thanks for all the responses to my suggestion. I realize this would
be a major change, so that's why I also mentioned it as an addition
to the language.
I'm sure it's just what you're used to, but
Donovan Brooke wrote:
however, from my experience, there is often this kind of problem in
any language, and that is where naming conventions come in very handy.
I don't know if the PHP community has any standard convention..
One popular naming convention:
Jim Lucas has it. You can use the preg_match function to find it. I would
use regexp for that reason. regexp is good for making sure things are typed
the way they need to (mostly used for).
Ravi.
On Sat, Dec 18, 2010 at 5:17 PM, Jim Lucas li...@cmsws.com wrote:
On 12/17/2010 12:52 PM, Sorin
On 12/17/2010 12:52 PM, Sorin Buturugeanu wrote:
Hello all!
I have a question regarding arrays and the way I can use a value.
Let's say I have this string:
$s = 'banana,apple,mellon,grape,nut,orange'
I want to explode it, and get the third value. For this I would normally do:
$a =
Hello all!
I have a question regarding arrays and the way I can use a value.
Let's say I have this string:
$s = 'banana,apple,mellon,grape,nut,orange'
I want to explode it, and get the third value. For this I would normally do:
$a = explode(',', $s);
echo $s[2];
That's all fine, but is there
[snip]
I have a question regarding arrays and the way I can use a value.
Let's say I have this string:
$s = 'banana,apple,mellon,grape,nut,orange'
I want to explode it, and get the third value. For this I would normally
do:
$a = explode(',', $s);
echo $s[2];
That's all fine, but is there a
On Fri, Dec 17, 2010 at 15:52, Sorin Buturugeanu m...@soin.ro wrote:
Hello all!
I have a question regarding arrays and the way I can use a value.
Let's say I have this string:
$s = 'banana,apple,mellon,grape,nut,orange'
I want to explode it, and get the third value. For this I would
Tanks for all of your responses!
I guess a function is the way to go. I just have to see if the situation
comes up enough times to justify the function approach.
@Dan: I really enjoyed your disclaimer :D
--
Sorin Buturugeanu
www.soin.ro
http://www.facebook.com/buturugeanu
On 27 October 2010 22:15, Kevin Kinsey k...@daleco.biz wrote:
Marc Guay wrote:
As Nicholas pointed out, the extra underscore in the key is the issue.
That's way too easy a fix. I think he should check to make sure his
version of PHP was compiled with the right extensions and that the
From: Richard Quadling
On 27 October 2010 22:15, Kevin Kinsey k...@daleco.biz wrote:
Marc Guay wrote:
As Nicholas pointed out, the extra underscore in the key is the issue.
That's way too easy a fix. I think he should check to make sure his
version of PHP was compiled with the right
Marc Guay wrote:
As Nicholas pointed out, the extra underscore in the key is the issue.
That's way too easy a fix. I think he should check to make sure his
version of PHP was compiled with the right extensions and that the
browser isn't doing something unpredictably bizarre when submitting
Ron Piggott schrieb:
I am writing a custom shopping cart that eventually the cart will be
uploaded to PayPal for payment. I need to be able to include the option
that the purchase is a gift certificate.
At present my add to cart function goes like this:
===
# Gift Certificate: 1 is a gift;
I am writing a custom shopping cart that eventually the cart will be
uploaded to PayPal for payment. I need to be able to include the option
that the purchase is a gift certificate.
At present my add to cart function goes like this:
===
# Gift Certificate: 1 is a gift; 2 is personal use
if
$_SESSION['life_coaching_order'][$product][$gift]['quantity'] =
$_SESSION['life_coaching_order'][$product][$gift]['quantity'] + 1;
===
...
===
foreach ($_SESSION['life_coaching_order'] AS $coaching_fee_theme_reference
= $value ) {
===
In this example $value would be an array. To test if it is
Many thanks, Chris.
I have one additional question about this shopping cart project. I need
to make a submit button for the purpose of removing an item from the
shopping cart.
input type=submit name=submit value=Remove class=place_order/
What I am struggling with is to find an effective
input type=submit name=submit value=Remove class=place_order/
I don't know what the context is like, but you may be better off just using
an entire form here with hidden fields. i.e.
form target=... action=...
input type=hidden name=submit value=Remove /
input type=hidden name=product_so
was explicitly created, php
made the next one at 3.
Thanks,
Ash
http://www.ashleysheridan.co.uk
- Reply message -
From: chris h chris...@gmail.com
Date: Sat, Sep 25, 2010 22:05
Subject: [PHP] Array question
To: MikeB mpbr...@gmail.com
Cc: php-general@lists.php.net
Mike,
$results
At 3:31 PM -0500 9/25/10, MikeB wrote:
-snip-
My question, in the loop, why does tha author use:
$results[] = mysql_fetch_array($result);
instead of (as I would expect):
$results[$j] = mysql_fetch_array($result);?
What PHP magic is at work here?
Mike:
That's just a shorthand way to
I have the following code:
$query = SELECT * FROM classics;
$result = mysql_query($query);
if (!$result) die (Database access failed: . mysql_error());
$rows = mysql_num_rows($result);
for ($j = 0 ; $j $rows ; ++$j)
{
$results[] = mysql_fetch_array($result);
}
mysql_close($db_server);
Mike,
$results[] will automatically push a value unto the end of an array.
So doing this...
--
$magic = array();
$magic[] = 'a';
$magic[] = 'b';
$magic[] = 'c';
-
is exactly this same as doing this...
--
$normal = array();
$normal[0] = 'a';
$normal[1] = 'b';
$normal[2] = 'c';
-
I have a query that may not always return a result for a value, I need
to reflect this with a 0. I am trying to overcome this by doing this
(the keys are ID's):
while ($row = mysql_fetch_row($statusQuery)) {
$cat = array(0=0,1=0,11=0,12=0,13=0,14=0,15=0,16=0,17=0,19=0);
switch
On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote:
I have a query that may not always return a result for a value, I need
to reflect this with a 0. I am trying to overcome this by doing this
(the keys are ID's):
while ($row = mysql_fetch_row($statusQuery)) {
$cat =
On Fri, Jul 30, 2010 at 3:44 PM, Joshua Kehn josh.k...@gmail.com wrote:
On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote:
I have a query that may not always return a result for a value, I need
to reflect this with a 0. I am trying to overcome this by doing this
(the keys are ID's):
while
On Jul 30, 2010, at 3:03 PM, Paul Halliday wrote:
Paul-
Why are those values not defaulted to 0 in the database?
Regards,
-Josh
They are defaulted, the query is grouping:
select count(status) as count, status from table group by status order
by status desc;
you are probably getting a memory limit error, check your php.ini
2010/7/21 fyang fy...@ipp.ac.cn:
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
'Twas brillig, and fyang at 22/07/10 03:34 did gyre and gimble:
Dear Bob McConnell,
Thank you for your reply.
I really post the same message eight times because of the first e-mail
authentication.please remove the extra e-mail in your free time.
There are two servers
Dear Colin Guthrie ,
Thanks for your help very much.
According to your suggestion, I have solved the question.
best wish,
Yang Fei
2010-7-24
From: fyang
I have a simple test code in different OS ,but it give me a
different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
or need other configurations.
Please give further guidance, thank you very much!
best wishs,
Yang Fei
2010-7-22
发件人: Bob McConnell
发送时间: 2010-07-21 20:06:36
收件人: fyang; php-general@lists.php.net
抄送:
主题: RE: [PHP] php array in different OS
From: fyang
I have a simple test
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
echo
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
echo
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
echo
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
echo
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
echo
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
echo
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
echo
Dear all,
I have a simple test code in different OS ,but it give me a different
result.
the code as follows:
?php
$n= 5;
for($i=0;$i$n;$i++)
{
$data[]=array(,$i,$i/1000);
echo $i, ,$data[$i][1],br;
}
echo
-Original Message-
From: Ron Piggott [mailto:ron.pigg...@actsministries.org]
Sent: 29 June 2010 22:22
Am I on the right track? I don't know what to do with the second
FOREACH
Sort of.
?php
foreach($_REQUEST as $key = $val) {
$$key = $val;
echo $key . : . $val
At 4:54 PM -0400 6/29/10, Ron Piggott wrote:
I am trying to process a form where the user uses checkboxes:
input type=checkbox name=painDesc[] value=1 /Sharp
input type=checkbox name=painDesc[] value=2 /Stabbing
input type=checkbox name=painDesc[] value=3 /Jabbing
When I do:
foreach($_REQUEST
I am trying to process a form where the user uses checkboxes:
input type=checkbox name=painDesc[] value=1 /Sharp
input type=checkbox name=painDesc[] value=2 /Stabbing
input type=checkbox name=painDesc[] value=3 /Jabbing
When I do:
foreach($_REQUEST as $key = $val) {
$$key = $val;
On Tue, 2010-06-29 at 16:54 -0400, Ron Piggott wrote:
I am trying to process a form where the user uses checkboxes:
input type=checkbox name=painDesc[] value=1 /Sharp
input type=checkbox name=painDesc[] value=2 /Stabbing
input type=checkbox name=painDesc[] value=3 /Jabbing
When I do:
The painDesc array is what that should be iterated.
--Shreyas
On Wed, Jun 30, 2010 at 2:27 AM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:
On Tue, 2010-06-29 at 16:54 -0400, Ron Piggott wrote:
I am trying to process a form where the user uses checkboxes:
input type=checkbox
Am I on the right track? I don't know what to do with the second FOREACH
?php
foreach($_REQUEST as $key = $val) {
$$key = $val;
echo $key . : . $val . br;
if ( $val == Array ) {
$i=0;
foreach ($val) {
Ron Piggott wrote:
I am trying to process a form where the user uses checkboxes:
input type=checkbox name=painDesc[] value=1 /Sharp
input type=checkbox name=painDesc[] value=2 /Stabbing
input type=checkbox name=painDesc[] value=3 /Jabbing
When I do:
foreach($_REQUEST as $key = $val) {
Hi,
which one is correct or better?
$array[3] = '';
or
$array['3'] = '';
$i = 7;
$array[$i] = '';
or
$array[$i] = '';
Br
Tanel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Tue, Jun 08, 2010 at 04:12:42PM +0300, Tanel Tammik wrote:
Hi,
which one is correct or better?
$array[3] = '';
or
$array['3'] = '';
If the index for (integer) 3, the first example is correct. If the index
is (string) '3', the second example is correct.
$i = 7;
$array[$i] = '';
On Tue, 2010-06-08 at 16:12 +0300, Tanel Tammik wrote:
Hi,
which one is correct or better?
$array[3] = '';
or
$array['3'] = '';
$i = 7;
$array[$i] = '';
or
$array[$i] = '';
Br
Tanel
The two indexes are equivalent, although I reckon the integer one will
give better
1 - 100 of 1246 matches
Mail list logo