I'm creating a form to append data into an XML database, which is being read by a widget on another page. The format that I need the data to be in is as follows:
<event start="1914" end="1918" isDuration="true" title="World War I" color="red">
Lots of guns and death.
</event>
However, I'm not sure how to do this with PHP's fwrite function because of the use of angle brackets and quotation marks. For example, I tried the following:
fwrite($database, <event start="$startdate" end="$enddate"
isDuration="$isDuration" title="$title" color="$color">
$description
</event>);
But this does not work, I get errors about unexpected angle brackets, etc. If anyone can help I would greatly appreciate it.
You're supposed to give it a string.
string
The string that is to be written.