I have a lookup form that contains the following line
Code: Select all
echo "<option value=\"".htmlspecialchars($animalid)."\">$animalid";If this is the record that is selected then I go to another form where the ID is echoed twice -
the first place is at the top
Code: Select all
$animal_to_use=strip_tags(trim($_POST['bulllist']));
$text_to_use="Upload Photos For ";
$titleline=$text_to_use.($animal_to_use);Code: Select all
echo "<h1 align='center'>$titleline</h1>";and when I do a var_dump($animal_to_use) I get the same value "butler\'s ignition #37"
NOW I use $animal_to_use in my SELECT Statement and it works just fine and so when I echo the results from my query
I also have the id in an input field using this
Code: Select all
echo "<tr>\n
<td align='right'><b>Animal</b></td>
<td><input type='text' name='animalid' READONLY value=\"".htmlspecialchars($animalid)."\"></td>
</tr>";I need to get a consistent result and I have to be able to work with field values that contain apostrophes and blank spaces.
Is there a better way to handle special characters such as the apostrophe, the number sign and blank spaces in field values?
I've googled htmlspecialchars and can't seem to find a lot of info on the proper way to use this function.
Thank you
