Dealing with & and other chars in a string
Posted: Sat Jan 28, 2012 4:18 pm
I am trying to create a form on the fly and data input that includes & does not show up.
The array is the input with output form below.
I've tried using htmlspecialchars() as below but it doesn't work. I'm using incorrectly somehow eh!
Thanks for your help in advance.
RP.
I've tried using htmlspecialchars() as below but it doesn't work. I'm using incorrectly somehow eh!
Thanks for your help in advance.
RP.
Code: Select all
foreach($connectData as $key => $value) {
if($key==Name_ID) continue;
printf("<tr>\n");
printf("<td>\n");
printf("<label for=%s>%s</label>\n",strtolower($key), $key);
printf("<input type=text name=%s id=%s value=%s>\n", strtolower($key), strtolower($key), htmlspecialchars($value));
printf("<td>\n");
printf("<tr>\n");
}