section31 Posted December 15, 2004 Posted December 15, 2004 This isn't really a script question, but here goes. You know the way you can send hidden variables in a form using the <input> tag. Well, I'm trying to send a hidden array variable. Arrays are normally sent through the <select multiple="multiple"> tag and I would like to send one while hidden. Is there any way of doing something like this. I was thinking about a workaround. I could build the form like normal, and use css tags to make it invisible. What do you think? If you need clarification, Just let me know. I can post an example if neccessary. Quote
TCH-RobertM Posted December 15, 2004 Posted December 15, 2004 not sure if you can use something like Sessions to accomplish this, Just a thought though... I am still learning about php so sorry if this is not in line with what you ar etrying to accomplish Quote
section31 Posted December 15, 2004 Author Posted December 15, 2004 nope, just to clarify something...it won't be using php. If there is such a thing, It will be something along these lines <input type="hidden" name="myarr" value="serialized_array" /> Quote
borfast Posted December 15, 2004 Posted December 15, 2004 You almost got it: <input type="hidden" name="myarr[]" value="serialized_array" /> The answer is those [ ] in the name attribute. Hope it helps Quote
section31 Posted December 15, 2004 Author Posted December 15, 2004 Geez, That was it.... Whats this, the 100th time Raul has helped me out. You deserve an award of some kind. Here is the final code for anyone else that ever needs to do something simliar. ><form action="foobar.php" method="post"> <input type="hidden" name="myarr[]" value="5" /> <input type="hidden" name="myarr[]" value="7" /> <input type="submit" /> </form> This will send a post variable ( $_POST['myarr'] ) as an array, indexed like the following. myarr[0] -> 5 myarr[1] -> 7 Quote
TCH-RobertM Posted December 15, 2004 Posted December 15, 2004 That is pretty Good stuff to know, Thanks for the update I will have to try that myself , Thanks again Quote
borfast Posted December 15, 2004 Posted December 15, 2004 (edited) An award? No way! I just like to help out where I can Psst, by the way, that's my bank account number, in that PM I just sent you... :) Edited December 15, 2004 by TCH-Raul Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.