|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome. |
Share Thread: & Tags
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
Is there any way to send form values as an array to a php script? I need to build a page that "knows" how many calendars to display, and am looking for the simplest method possible to send the caledar id fields to the script.
I've tried: somepage.php?calid=1&calid=2... Obviously the second calid simply negates the first. is there a way to send this information in a similar fashion, or will it be necessary to set it up as something like: somepage.php?calid1=1&calid2=2... Any advice is appreciated
__________________
Jerry Russell Cooking by the Seat of my Pants | Please don't feed the writer | The Spun Puppy |
|
|||
|
Hi,
How about combining all the ids into a string from the array using implode and passing that as the parameter. e.g. test.php?calid=1;2;3;4;5;6 then use explode to seperate them back into an array? i know it's not a very neat url but hey if it works. or am i misunderstanding the question? |
|
||||
|
You had it right on the mark, and if I were more experienced in php, i probably would have gone that way.
Instead, i used an array of calid's, as such: somepage.php?calid[]=123&calid[]=456... then it's as simple as using a for each to go through it as in the following example: Code:
$calids = $_GET['calid'];
foreach ($calids as $name => $value){
//work some php magic here...
print $value;
//and the rest of the magic
}
__________________
Jerry Russell Cooking by the Seat of my Pants | Please don't feed the writer | The Spun Puppy |
|
|||
|
Use $_POST instead. form method to post. The url will be clean.
|
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |