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
Post a Comment