Jump to content

input arrays question


Demonic

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.