[PHP-WIN] Retrieving URL of webpage etc.

2009-08-09 Thread Jacob Kruger

Hi there

I'm specifically doing something like displaying search results up to 50 
records, and I would like to be able to provide something like a checkbox 
next to each of them to allow multiple records to then be deleted at one 
time, but the problem seems to be that either either checkbox needs to be 
assigned a different name, or else I would need to be able to parse the URL 
of the resulting page when the form is submitted since I don't seem to be 
able to access something like an array of values for a form field with the 
shared name of the multiple checkboxes, since while it will allow me to read 
from an array for the name of that form field:

$_GET['chkBox'][0]

It tells me the count for that array is only 1, and always returns the last 
checked value.


Therefore, I could either try use something like javascript to populate a 
hidden form field with the various values when the checkboxes are checked, 
or else could try just doing something like parsing the querystring/URL 
since it does get populated with something like:

chkBox=1&chkBox=2

for example...

Any thoughts on this, and thoughts on what would be the best workaround?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'


__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4318 (20090808) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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



Re: [PHP-WIN] Retrieving URL of webpage etc.

2009-08-09 Thread Richard Quadling
2009/8/9 Jacob Kruger :
> Hi there
>
> I'm specifically doing something like displaying search results up to 50
> records, and I would like to be able to provide something like a checkbox
> next to each of them to allow multiple records to then be deleted at one
> time, but the problem seems to be that either either checkbox needs to be
> assigned a different name, or else I would need to be able to parse the URL
> of the resulting page when the form is submitted since I don't seem to be
> able to access something like an array of values for a form field with the
> shared name of the multiple checkboxes, since while it will allow me to read
> from an array for the name of that form field:
> $_GET['chkBox'][0]
>
> It tells me the count for that array is only 1, and always returns the last
> checked value.
>
> Therefore, I could either try use something like javascript to populate a
> hidden form field with the various values when the checkboxes are checked,
> or else could try just doing something like parsing the querystring/URL
> since it does get populated with something like:
> chkBox=1&chkBox=2
>
> for example...
>
> Any thoughts on this, and thoughts on what would be the best workaround?
>
> TIA
>
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...fate had broken his body, but not his spirit...'
>
>
> __ Information from ESET NOD32 Antivirus, version of virus signature
> database 4318 (20090808) __
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Say the ID of the row from the DB is held in $a_Row['ID'].

Make the name of the checkbox ...

name="delete[{$a_Row['ID']}]"

Now, $_POST['delete'] will be an array of IDs to delete.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP-WIN] Retrieving URL of webpage etc.

2009-08-09 Thread Jacob Kruger

In this part:
name="delete[{$a_Row['ID']}]"

I presume I would be including that in the echo for the checkbox elements 
somehow?


Something along the lines of:
echo '';

Sorry, but haven't really done too much with PHP before apart from simple 
things like guestbooks etc.


TIA

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

- Original Message - 
From: "Richard Quadling" 

To: "Jacob Kruger" 
Cc: 
Sent: Sunday, August 09, 2009 10:18 AM
Subject: Re: [PHP-WIN] Retrieving URL of webpage etc.



2009/8/9 Jacob Kruger :

Hi there

I'm specifically doing something like displaying search results up to 50
records, and I would like to be able to provide something like a checkbox
next to each of them to allow multiple records to then be deleted at one
time, but the problem seems to be that either either checkbox needs to be
assigned a different name, or else I would need to be able to parse the 
URL

of the resulting page when the form is submitted since I don't seem to be
able to access something like an array of values for a form field with 
the
shared name of the multiple checkboxes, since while it will allow me to 
read

from an array for the name of that form field:
$_GET['chkBox'][0]

It tells me the count for that array is only 1, and always returns the 
last

checked value.

Therefore, I could either try use something like javascript to populate a
hidden form field with the various values when the checkboxes are 
checked,

or else could try just doing something like parsing the querystring/URL
since it does get populated with something like:
chkBox=1&chkBox=2

for example...

Any thoughts on this, and thoughts on what would be the best workaround?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'


__ Information from ESET NOD32 Antivirus, version of virus 
signature

database 4318 (20090808) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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




Say the ID of the row from the DB is held in $a_Row['ID'].

Make the name of the checkbox ...

name="delete[{$a_Row['ID']}]"

Now, $_POST['delete'] will be an array of IDs to delete.

--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
ZOPA : http://uk.zopa.com/member/RQuadling

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


__ Information from ESET NOD32 Antivirus, version of virus 
signature database 4318 (20090808) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com






__ Information from ESET NOD32 Antivirus, version of virus signature 
database 4318 (20090808) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




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



Re: [PHP-WIN] Retrieving URL of webpage etc.

2009-08-09 Thread gunawan

answer is near right.. but i have better solution..
echo '';
i change into ...
echo '';

change id into the id you like to delete..
in delete.php u just type this

foreach($delete as $val)
   deleteRow($val); //function to delete id in table zz

for your info.. u should not delete the row.. better make them not 
active intead of delete.. if you sure the script aren't have problem.. u 
can delete it.. but remember to backup your DB or ELSE

*like me.. lost half DB

Jacob Kruger wrote:

Hi there

I'm specifically doing something like displaying search results up to 
50 records, and I would like to be able to provide something like a 
checkbox next to each of them to allow multiple records to then be 
deleted at one time, but the problem seems to be that either either 
checkbox needs to be assigned a different name, or else I would need 
to be able to parse the URL of the resulting page when the form is 
submitted since I don't seem to be able to access something like an 
array of values for a form field with the shared name of the multiple 
checkboxes, since while it will allow me to read from an array for the 
name of that form field:

$_GET['chkBox'][0]

It tells me the count for that array is only 1, and always returns the 
last checked value.


Therefore, I could either try use something like javascript to 
populate a hidden form field with the various values when the 
checkboxes are checked, or else could try just doing something like 
parsing the querystring/URL since it does get populated with something 
like:

chkBox=1&chkBox=2

for example...

Any thoughts on this, and thoughts on what would be the best workaround?

TIA

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'


__ Information from ESET NOD32 Antivirus, version of virus 
signature database 4318 (20090808) __


The message was checked by ESET NOD32 Antivirus.

http://www.eset.com







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