Don wrote:
Hi Have have a varchar field in a MySQL database which contains the
following
905.362.6000"l""s"'L'
I am trying to display it on my web page in a <INPUT="TEXT"> field but all I
see is:
905.362.6000
Because it has quotes in it. I bet if you look at the source of the
page, the full value is there. If your form field looks like this...
<input type="text" name="foo" value="$value" />
It's going to output like this....
<input type="text" name="foo" value="905.362.6000"l""s"'L'" />
-------------------------------------------------^
So when the browser sees the first double quote in your value, it
assumes that you're closing off the attribute.
Try running the value thru htmlentities()
I am wondering why the trailing characters do not display even though they
are present in the database when I check using PhpMyAdmin. Please help.
Thanks in advance
My code snippet is as follows:
<tr>
<td><font color="#FF0000"><b>Phone</b></font></td>
<td><input type="text" name="phone" value="<?PHP echo
query_database($db_account->Phone); ?>" size="25"></td>
</tr>
The query_database() function is my own and looks as follows:
// smart function for querying a MySQL database
function query_database($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not a number or a numeric string
if (!is_numeric($value)) {
$value = mysql_real_escape_string($value);
}
return $value;
}
Why are you running mysql_real_escape_string() after selecting data?
--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnichel@xxxxxxxxxxxxxxxxxxxxxxxxxxx
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php