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
https://forums.phpfreaks.com/topic/95090-input-arrays-question/
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
https://forums.phpfreaks.com/topic/95090-input-arrays-question/#findComment-487123
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.