View Full Version : Catch a double bracket variable on $_POST
Logikos
09-13-2005, 06:51 AM
I want to use this in a hack i'm making
print_input_row($vbphrase['var_name'], 'var[setting][forumid]', $var['setting']['forumid']);
How would I grab the info to insert it in the database?
$_POST['var[setting][forumid]']; Doesn't work...
I see alot of people useing variables with double brackets like that, and I can't seem to understand it yet. Is there any time of tutorial like that?
Andreas
09-13-2005, 06:55 AM
Those are arrays :)
You can access it as $_POST['var']['setting']['forumid'] (and of course it should be run through clean_array_gpc).
To get a better understanding, print_r($_POST) might help.
Paul M
09-13-2005, 07:03 AM
Those are arrays :)Indeed, and damn useful things they are as well. :)
Logikos
09-13-2005, 07:04 AM
Perfect! :)
I have a hack that will have its own custom settings. Over 50 right now... I want to make it so when the user presses the save button, it updates everything quickly...
I don't want to have to have to add 50+ clean_array_gpc's... If i had something like this for example:
print_input_row($vbphrase['var_name'], 'var[setting][setting1]', $var['setting']['setting1']);
print_input_row($vbphrase['var_name'], 'var[setting][setting2]', $var['setting']['setting2']);
print_input_row($vbphrase['var_name'], 'var[setting][setting3]', $var['setting']['setting3']);
print_input_row($vbphrase['var_name'], 'var[setting][setting4]', $var['setting']['setting4']);
print_input_row($vbphrase['var_name'], 'var[setting][setting5]', $var['setting']['setting5']);
How would I call all of them eaisly with the clean_array_gpc, and insert them into the database?
A foreach(); maybe?
clean_array_gpc will take an array, you will still need to input every variable name, but its worth it.
A foreach wont work for clean_array_gpc
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.