Demonic Posted March 8, 2008 Share Posted March 8, 2008 Right I was looking at vB's source code trying to figure out how they did the update forum order, so I found this: $cell[] = "<input type=\"text\" class=\"bginput\" name=\"order[$forum[forumid]]\" value=\"$forum[displayorder]\" tabindex=\"1\" size=\"3\" title=\"" . $vbphrase['edit_display_order'] . "\" />"; order[1] if I did $_POST['order'][1];//would that get that value? If I did something like the code above but in another way? Link to comment https://forums.phpfreaks.com/topic/95090-input-arrays-question/ Share on other sites More sharing options...
cytech Posted March 8, 2008 Share Posted March 8, 2008 In theory yes - that would pull any string in the "value" attribute. Link to comment https://forums.phpfreaks.com/topic/95090-input-arrays-question/#findComment-487122 Share on other sites More sharing options...
Demonic Posted March 8, 2008 Author Share Posted March 8, 2008 In theory? (isn't theory) <?php if(!isset($_POST['form'])) { ?> <form method='post'> <input type='text' name='order[1]' value='1' /> <input type='text' name='order[2]' value='2' /> <input type='text' name='order[3]' value='1' /> <input type='text' name='order[4]' value='3' /> <input type='text' name='order[5]' value='1' /> <input type='text' name='order[6]' value='4' /> <input type='submit' name='form' /> </form> <?php } else { foreach($_POST['order'] as $key => $val ) { echo "forum id: " . $key . ", forum order: " . $val; echo "<br>"; } } ?> Array ( [order] => Array ( [1] => 1 [2] => 2 [3] => 1 [4] => 3 [5] => 1 [6] => 4 ) [form] => Submit Query ) Thanks I guess.. Link to comment https://forums.phpfreaks.com/topic/95090-input-arrays-question/#findComment-487123 Share on other sites More sharing options...
Barand Posted March 8, 2008 Share Posted March 8, 2008 When you have a statement like this, If I did something like the code above but in another way? how can you expect a specific answer when only you know what "another way" is? I read your post earlier but ignored it for that reason. Link to comment https://forums.phpfreaks.com/topic/95090-input-arrays-question/#findComment-487174 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.