bpgillett Posted April 16, 2007 Share Posted April 16, 2007 hi. echoing a string in my array from $_POST by numeric position returns nothing; however, referencing it by variable name works. is there a problem referencing an array created from $_POST by numeric position? if so, any way around this? thanks. works: $post = $_POST; echo $post['q1']; doesn't work: $post = $_POST; echo $post[0]; Quote Link to comment Share on other sites More sharing options...
Dragen Posted April 16, 2007 Share Posted April 16, 2007 surely $post = $_POST; should be something like $post = $_POST['q1']; Quote Link to comment Share on other sites More sharing options...
Barand Posted April 16, 2007 Share Posted April 16, 2007 $_POST is an associative array whose keys are the names of form fields. If you want to process it as an indexed array you can $post = array_values($_POST); However, if the only reason to do this is to loop through all the values then you can use foreach ($_POST as $value) { echo $value; } Quote Link to comment Share on other sites More sharing options...
bpgillett Posted April 17, 2007 Author Share Posted April 17, 2007 thanks...i feel a little silly. i'm actually manipulating the keys which are dynamically named from another page, so i have to reference them by there numeric position in an indexed array. thanks again. --brian 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.