Hello all,
I need a little help in figuring out just one little thing on my first real PHP program.
As background, I have a Flash MX "engine" that takes an XML file, any number of images/audio/video files and presents that in a slideshow form, based on the structure of the XML file.
I created a PHP system that allows me to quickly build that xml file. The PHP scans a directory of images and gives me an edit screen that has fields for the screen title, drop downs for selected images or audio, etc.
There is also an edit screen for making changes to an existing xml file. It reads it in, creates the proper number of options and fills in the form with all the current data.
This is where the issue is. If a user enters something like: "That's the best screen" it will save properly in the XML.
<screenTitle>That's the best screen</screenTitle>
When it gets read back in, it also is properly in the array:
SimpleXMLElement Object ( [0] => That's the best screen )
But to build my form I'm using a simple loop and a basic echo statement to construct the html. But when it hits that single quote it drops off the rest of the data and you'd just get a form field with "That" in it.
Here's the echo that writes out that form field:
echo("<input type='text' name='screentitle" . $i . "' value='" . $screenTitles[$i] . "'><br>\n");
So my question, how can I maintain the full and proper value when inserting back into the form field? I've tried variations on how I'm writing the html, tried addslashes(), etc. I'm sure this is easy, I just can't quite get it.
Thanks!