bigdoggy59 Posted April 13, 2009 Share Posted April 13, 2009 This is the strangest thing I've ever seen... Building an HTML form from a query I have: echo $nsn; echo "<input type='hidden' name='NSN[$idx]' value='$nsn'/>"; echo "</td>\n"; Looking at the source in the browser I see: <input type='hidden' name='NSN[0]' value='8465014652096'/> <input type='hidden' name='NSN[1]' value='GSA-700'/> On the next page, a print_r($NSN) returns: Array ( [0] => GSA-700 [1] => 8465014652096 ) 1 Note that the index numbers=>values have been re-ordered. Why is this happening and how do I stop it? None of the other arrays in the app are doing this, only this one. Thanks Link to comment https://forums.phpfreaks.com/topic/153890-input-array-sorting-automatically/ Share on other sites More sharing options...
ToonMariner Posted April 13, 2009 Share Posted April 13, 2009 <?php foreach($NSN as $key => $val) { echo '<input type="hidden" name="NSN['.$key.']" value="'.$val.'" />'; } ?> Link to comment https://forums.phpfreaks.com/topic/153890-input-array-sorting-automatically/#findComment-808816 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.