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 Quote Link to comment 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.'" />'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.