I know how to use str_replace(), but this is just beyond me. Here’s the input (would come from a MySQL query):
[%] This is a checkbox
[%] I have seen "Star Trek VI: The Voyage Home"
[%] I'm a geek
Here’s how I would like the output rendered:
<label><input type="checkbox" name="requirement[1]" value="1">This is a checkbox</label>
<label><input type="checkbox" name="requirement[2]" value="1">I have seen "Star Trek VI: The Voyage Home"</label>
<label><input type="checkbox" name="requirement[3]" value="1">I'm a geek</label>
Obviously, having the [%] at the beginning of the line would denote it becoming a checkbox as would being on separate lines (unless there’s a better, user-friendly way). If there’s a better way than using str_replace(), I’d love to know.
Thanks in advance!
Edit: Yup: example here.