[PHP-DB] Urgent help needed
Hi there everyone, I have this system where you can create folders on your HD for inserting PDF files via a web interface and you can also remove these folders, this works no problem, but I have run into a snag, I need to send more than 1 field in the below array via a form, how can I do? Basically, aswell as sending the ID, I need to send the title and path too and i'm abit confused. input type=checkbox name=del[] value=?=$id? Any help would be VERY appreciated :-) Thanks everyone. Chris
Re: [PHP-DB] Urgent help needed
Chris Payne wrote: Basically, aswell as sending the ID, I need to send the title and path too and i'm abit confused. input type=checkbox name=del[] value=?=$id? You could pass the value as id/title/path where / is a delimiter, then pull it apart on the other side. Or, you could format 3 different elements like this: input type=checkbox name=del[?=$id?] value=?=$id? input type=hidden name=title[?=$id?] value=?=$title? input type=hidden name=path[?=$id?] value=?=$path? Now, when a checkbox is checked, you'll end up with something like $del[1234]. Just pull the key or value and then you'll be able to determine $title[1234] and $path[1234] to use in your script. foreach($del as $id) { echo Deleting id: $id, title: {$title[$id]}, path: {$path[$id]}; } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Urgent help needed
Chris - it might take a little work, but I think I have a good solution for ya. I would maybe use the $id as the key, and then use hidden inputs to set the other stuff in a multidimensional array. like so input type=checkbox name=del[?=$id?][path] value=?=$path? input type=hidden name=del[?=$id?][title] value=?=$title then, on the flip side of the script when you need the data, the array keys are the actual id's you need, and the multidimensional array has keys of [path] and [title] like below $del[1][path] == '/home/monkey'; $del[1][title] == 'monkeystuff'; $del[2][path] == 'home/donkey/'; $del[2][title] == 'donkeystuff'; you can access this array by doing the following... foreach($del as $id = $slot) { echo $id.'br /'; echo 'path = '.$slot[path].'br /'; echo 'title = '.$slot[title].'br /'; } Hope this helps... Rolf Brusletto phpExamples.net http://www.phpExamples.net Chris Payne wrote: Hi there everyone, I have this system where you can create folders on your HD for inserting PDF files via a web interface and you can also remove these folders, this works no problem, but I have run into a snag, I need to send more than 1 field in the below array via a form, how can I do? Basically, aswell as sending the ID, I need to send the title and path too and i'm abit confused. input type=checkbox name=del[] value=?=$id? Any help would be VERY appreciated :-) Thanks everyone. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Urgent help needed
Or you could hire John or me to do it for you. :-) Just kidding. I used the delimiting solution all over the place it is pretty simple. Ryan -Original Message- From: John W. Holmes [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 4:42 PM To: Chris Payne Cc: [EMAIL PROTECTED] Subject: Re: [PHP-DB] Urgent help needed Chris Payne wrote: Basically, aswell as sending the ID, I need to send the title and path too and i'm abit confused. input type=checkbox name=del[] value=?=$id? You could pass the value as id/title/path where / is a delimiter, then pull it apart on the other side. Or, you could format 3 different elements like this: input type=checkbox name=del[?=$id?] value=?=$id? input type=hidden name=title[?=$id?] value=?=$title? input type=hidden name=path[?=$id?] value=?=$path? Now, when a checkbox is checked, you'll end up with something like $del[1234]. Just pull the key or value and then you'll be able to determine $title[1234] and $path[1234] to use in your script. foreach($del as $id) { echo Deleting id: $id, title: {$title[$id]}, path: {$path[$id]}; } -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Urgent help needed
In the input definition onclick call a javascript function with all your parameters. Might be a missing quote here and there but this is close to ones I use all the time: echo brinput type=button value = \Go\ onClick=\yourjavascriptfunction('$parameter1','$parameter2','$parameter3')\; Now here is what is in yourjavascriptfunctio('$parameter1,$parameter2,$parameter3'): function yourjavascriptfunction(this1,this2,this3) { window.open(proofexcel.php3?batch_id= + window.document.forms(0).LabBatchPicker.value + parameter1= + this1 +parameter2=+ this2 + parameter3= + this3 ); return true; } Lots of different ways you can do this. Let me know Chris Payne [EMAIL PROTECTED] wrote: Hi there everyone, I have this system where you can create folders on your HD for inserting PDF files via a web interface and you can also remove these folders, this works no problem, but I have run into a snag, I need to send more than 1 field in the below array via a form, how can I do? Basically, aswell as sending the ID, I need to send the title and path too and i'm abit confused. [input] name=del[] Any help would be VERY appreciated :-) Thanks everyone. Chris - Do you Yahoo!? The New Yahoo! Shopping - with improved product search