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]']); 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]]); 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 Link to comment https://forums.phpfreaks.com/topic/221990-array-from-post/#findComment-1148701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.