Ryflex Posted December 17, 2010 Share Posted December 17, 2010 Hi all, Can anyone tell me why the declaration below won't work??? Thnx Ryflex $amount = array(0 => $_POST['$n[0]'], 1 => $_POST['$n[1]'], 2 => $_POST['$n[2]'], 3 => $_POST['$n[3]']); Quote Link to comment https://forums.phpfreaks.com/topic/221990-array-from-post/ Share on other sites More sharing options...
marcus Posted December 17, 2010 Share Posted December 17, 2010 It wouldn't work because you would have undefined indexes. Your code is telling the server to look for a POST var called "$n[0]" not the actual value of $n[0]. Try this: $amount = array(0 => $_POST[$n[0]], 1 => $_POST[$n[1]], 2 => $_POST[$n[2]], 3 => $_POST[$n[3]]); Quote Link to comment https://forums.phpfreaks.com/topic/221990-array-from-post/#findComment-1148699 Share on other sites More sharing options...
Ryflex Posted December 17, 2010 Author Share Posted December 17, 2010 Thnx that worked Ryflex Quote Link to comment https://forums.phpfreaks.com/topic/221990-array-from-post/#findComment-1148701 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.