Driving me crazy.
I have some "title" fields that have characters that cause issues with PHP, etc (', ")
These are getting pulled from the DB and placed into an array and then used to populate a drop-down list (the second field is a "Year" field):
<?php
while ($row = mysql_fetch_row($list)) {
printf("<option value=".urlencode($row[0]).">".$row[0]." - ".$row[1]."</option>\n");
}
?>
This is working except that I do not get records like " Kelly's Heroes " because of the apostrophe. They just dont show.
If I do this and try to stripslashes during the loop:
<?php
while ($row = mysql_fetch_row($list)) {
$row[0] = stripslashes($row[0]);
printf("<option value=".urlencode($row[0]).">".$row[0]." - ".$row[1]."</option>\n");
}
?>
I get nothing populated in the drop down list.
If I do this:
while ($row1 = mysql_fetch_row($list)) {
$row1[0] = stripslashes($row1[0]);
printf($row1[0]."<br>\n");
}
I get a nice list of everything in the DB (even the ones with the crazy characters)
So, how do I get the two of these two merge and play nice?
can I use that second working piece and dump that array (slashes stripped) into a new array and use that for the drop-down list?