473,320 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Quotes from Db into textfield

Hi there,

i have a problem of wich i doubt it can be solved properly:
If i call a text from a (mySQL) database, and want to echo it into a
textfield (e.g. in a form) i experience the following problem (wich
makes sense, but wich i can't solve):

Imagine the following:
$db_string = 'The speech started as following: "Ladies and Gentlemen!".';
Source php: <input name="textfield" type="text" value="<?php echo $db_string; ?>">
Source html: <input name="textfield" type="text" value="The speech started as following: "Ladies and Gentlemen!".">
Wich only displays on the site: The speech started as following:


Makes sense to me, but i cannot figure out how to solve it ...
(escaping with \" makes the backslash the last char)

Frizzle.

Mar 1 '06 #1
4 1822
..oO(frizzle)
i have a problem of wich i doubt it can be solved properly:
If i call a text from a (mySQL) database, and want to echo it into a
textfield (e.g. in a form) i experience the following problem (wich
makes sense, but wich i can't solve):


www.php.net/htmlspecialchars

Micha
Mar 1 '06 #2
Michael Fesser wrote:
.oO(frizzle)
i have a problem of wich i doubt it can be solved properly:
If i call a text from a (mySQL) database, and want to echo it into a
textfield (e.g. in a form) i experience the following problem (wich
makes sense, but wich i can't solve):


www.php.net/htmlspecialchars

Micha


OK, i get what you mean, but i had already thought of that, but kind of
immediately faced the following problem: What if someone writes a
HTML-tutorial, and uses

&quot;

as a text, or even

"&quot;"

which would become

"""

So i believe this isn't the solution yet ... ( ? )

Frizzle.

Mar 2 '06 #3
..oO(frizzle)
OK, i get what you mean, but i had already thought of that, but kind of
immediately faced the following problem: What if someone writes a
HTML-tutorial, and uses

&quot;

as a text, or even
This would become

&amp;quot;
"&quot;"

which would become

"""


It would become

&quot;&amp;quot;&quot;

Micha
Mar 2 '06 #4

Michael Fesser wrote:
.oO(frizzle)
OK, i get what you mean, but i had already thought of that, but kind of
immediately faced the following problem: What if someone writes a
HTML-tutorial, and uses

&quot;

as a text, or even


This would become

&amp;quot;
"&quot;"

which would become

"""


It would become

&quot;&amp;quot;&quot;

Micha


Ok, i get this, but if i call the text from the DB and put it into a
field:
from the db (raw) : "
into html textfield : ... value="&quot;" ...

It should display correctly, but what i meant, if a person types
another
quote into the field, so both are original quotes, things get messed
up,
because there is a html quote in it, and a real one.

I could use html_entities_decode, but this would also mess up the html-
tutorial characters ...

Frizzle.

Mar 5 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: C. Armour | last post by:
Help me, I'm suffering! Situation: I have a load() function which loads a bunch of TextFields with values. There are TextListeners registered for each of these TextFields. Thus, changing the...
1
by: Ted Weatherly | last post by:
Hello, I want to dynamically create a table cell with a textfield in it. The value for the textfield can have quotes. e.g. I have this snippet of javascript code: var td =...
3
by: Sidney Linkers | last post by:
Hi, I'm trying to make a calculated text field in a query where the textvalue is being populated from multiple records. I already use a VBA function to loop through records and concatenate the...
1
by: Jeff | last post by:
Lets say we have double quotes in a string and we want to set a textfield to that value: $string = ' my "string"'; <input type="text" value="$string"> The double quotes will wreck havoc. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.