arrays - How to retrieve data from string in php? -


i have array 1 : monday, tuesday, wednesday, thursday, friday, saturday,. have each day separately , each 1 need need add checkbox near .thank help.

you need store days array able loop through them foreach loop.

<?php $days = array(     'monday',     'tuesday',     'wednesday',     'thursday',     'friday',     'saturday',     'sunday' );  foreach($days $day) {     echo $day;     echo '<input type="checkbox">'; } ?> 

update:

as have stored days string, need explode string convert array can loop through them.

<?php $days = "monday, tuesday, wednesday, thurday, friday, saturday, sunday"; $days = explode(", ", $days);  foreach($days $day) {     echo $day;     echo '<input type="checkbox">'; } ?> 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -