MDanz Posted October 28, 2010 Share Posted October 28, 2010 $itemlisted = $_POST['itemlisted']; unset($_SESSION['items']['$itemlisted']); e.g. $itemlisted = 5 so i want [5] deleted from the array. is the above way correct? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 28, 2010 Share Posted October 28, 2010 It should work. Did it fail when you tried it? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 28, 2010 Share Posted October 28, 2010 No single-quotes around php variables as that would make $itemlisted the string made up of the characters: $ i t e m l i s t e d - unset($_SESSION['items'][$itemlisted]); Quote Link to comment Share on other sites More sharing options...
MDanz Posted October 28, 2010 Author Share Posted October 28, 2010 ok thx... if i deleted [5] how do i get [6] to replace [5] etc... so the array counts is normal like [0],[1],[2] etc Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted October 28, 2010 Share Posted October 28, 2010 Yup, PFM is right. I overlooked the quotes in there . . . Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 28, 2010 Share Posted October 28, 2010 ok thanks... if i deleted [5] how do i get [6] to replace [5] etc... so the array counts is normal like [0],[1],[2] etc ^^^ Why do you think you need to do that? You and your code should not care. It should simply iterate over the entries in the array. 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.