The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
cycle through various POST array variables and types
I know I remember this from way back when, but I need to find some code that cycles through all the variables of a POST array...and if the variable is, itself, an array, it splits it into its individual values.
For instance, my config screen has a multiple select box, in addition to several regular text boxes, etc. While the text boxes will return a single value, the select box returns an array. I'm hoping to find some simple code to cycle through both types, and output the name/value pairs to a querystring. Any ideas? |
#2
|
|||
|
|||
if you're reffering to the HTTP_POST_VARS then you can cycle through them:
PHP Code:
and you can adjust the script to get the effect you're looking for... regards, g-force2k2 |
#3
|
|||
|
|||
You rock, thank you. I can then extrapolate the same function for finding out whether the key holds an array, I would think, like so:
PHP Code:
Thanks. I'm an ass. Should have known. |
#4
|
|||
|
|||
well the actual array values are seperated into their respected values...
if you're trying to get the array of values and search though them then i think this is what you should use... for instance for an input value to be an array it would require the name to be Code:
<input type="text" name="varname[]" value=""> PHP Code:
regards, g-force2k2 |
#5
|
|||
|
|||
I'm not searching through the array; I'm outputting all the values passed.
The script to parse ALL the post vars worked fantastic, but I ran into a problem trying to handle post arrays. Here's the code: PHP Code:
For what I'm trying to do, take a look at the following: www.acuraworld.com/forums/jsconfig.php The script is being used to output a customized syndicated content feed. All the other vars are working fine, but I'm not having any luck passing forumid (look at the script tag in the textarea at the bottom of the screen after you've selected a couple of forums). |
#6
|
|||
|
|||
ah didn't know you were using a multiple select form
so thats the array that you're trying to get the data for yes? ( which represent the forumids ) regards, g-force2k2 |
#7
|
|||
|
|||
Yeah - as you can see from the script tag it outputs, it just says "forumid=Array"...even though, when I uncomment my loop statements for debugging, it IS entering the is_array loop structure.
I don't get it! I'm very close to having this thing done, and I really wish it would work, already! :P |
#8
|
|||
|
|||
yes well looking at the code no matter how many ones you select the form will only return one id on a multiple select that i was just testing... any ideas on how to get all of the values that are selected?
g-force2k2 |
#9
|
|||
|
|||
? The code output at the top that says "Option ## selected" shows you the multiple options passed...? This same type of loop is generating that output, except the post variable name I'm looking for is specified instead of inferred.
Works fine on my end, as far as passing multiple values goes. It's just getting them to display that's the problem. |
#10
|
|||
|
|||
okay my bad i got the array to pass as well, but what do you mean you can get them to display?
when i submit it says what options are selected but what effect were you trying to achieve? err... nvm i see the string that you're trying to make but is that the problem that its not coming out as you wanted it to? g-force2k2 |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|