I have a simpleXML array called $tags
that contains a list of tags which I would like to use for the default value of an input field when loading a page.
My XML (example):
Array ( [0] => SimpleXMLElement Object ( [0] => tag1 )
[1] => SimpleXMLElement Object ( [0] => tag2 )
)
My HTML (for demonstration):
<input type="text"
class="form-control optional sel2" id="tags" name="tags"
value="<?php echo $tags; ?>"
/>
The above is just for demonstration as I don't know what is the correct approach for this. How can I get the values from the array set as the default value for the input field so that in the above example this would show "tag1,tag2
"?