megetron Posted April 14, 2012 Share Posted April 14, 2012 hi, I need to save array of elements form INPUT html element to a database, and on other page I need to display it again, so I need to SET the INPUT element again. here is th input array: <input type='hidden' name='elements[]' value='$categories' />" how do I do that? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/260932-array-input-with-php/ Share on other sites More sharing options...
gristoi Posted April 16, 2012 Share Posted April 16, 2012 you need to serialise the data before you put it into the database: <?php //preparing for inserting into db $array = array(1,2,3,4,5,6,7); $readyForDb = serialize($array); //extracting from db $array = unserialize($row['from the db']); Quote Link to comment https://forums.phpfreaks.com/topic/260932-array-input-with-php/#findComment-1337756 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.