jarv Posted August 4, 2011 Share Posted August 4, 2011 hi, on my site I have 6 checkboxes: Box1 = Internet Box2 = Yellow pages Box3 = Van Box4 = Letting agent Box5 = Repeat customer Box6 = Recommendation which ever is checked they go into the database as a number, for example, if all were checked I get 0|1|2|3|4|5 in my database. This all works fine but, I need to show which are checked, if my database had: 0|2|4 I need it to say: Internet, Van, Repeat Customer please help? Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 4, 2011 Share Posted August 4, 2011 $names = array('Internet','Yellow pages','Van','Letting agent','Repeat customer','Recommendation'); // assuming you have a var called $dbValues with the results from database and that it looks like this: 0|1|3 $dbNumbers = explode("|",$dbValues); $n = array(); foreach($dbNumbers as $num){ $n[]=$names[$num]; } echo implode(", ",$n); 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.