The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
Problem with quotations in Text Fields
Discuss Problem with quotations in Text Fields in the PHP Development forum on Dev Shed. Problem with quotations in Text Fields PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

June 2nd, 2000, 08:30 AM
|
|
Registered User
|
|
Join Date: Jun 2000
Posts: 28
Time spent in forums: 7 h 47 m 40 sec
Reputation Power: 0
|
|
I'm new to PHP & MySql and have run into a problem when retrieving field data from MySql and inputting it into a Text field for editing and updating in the database.
The inputted info has href/jscript popup window code in it. The problem is the quotation marks in the HREF interfere with the quotation marks in the Text Field.
ie <INPUT VALUE="<a href="#" onClick="etc..
The returned code in the Text Field gets cut off after href= because the Value parameter is closed by the " of the HREF.
I know this is more a HTML problem than PHP/MySql, but is there a way to avoid this or do I have to leave out the quotations?
(I hope I've explained it ok  )
If anybody can help I'd greatly appreciate it.
|

June 2nd, 2000, 08:42 AM
|
 |
Senior Member
|
|
Join Date: Jun 2000
Location: Enschede, The Netherlands
Posts: 1,527
Time spent in forums: 2 h 55 m 57 sec
Reputation Power: 14
|
|
|
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Sidane:
The problem is the quotation marks in the HREF interfere with the quotation marks in the Text Field.
The returned code in the Text Field gets cut off after href= because the Value parameter is closed by the " of the HREF.
[/B][/quote]
Hi, I'm quite new to this stuff myself, but I think you have to use a backslash ('') before a quotation mark if you don't want the script to think the string ends...
ie print( "Bla bla bla "bla bla" bla );
will result in the string: Bla bla bla "bla bla" bla
|

June 2nd, 2000, 08:48 AM
|
|
Registered User
|
|
Join Date: Jun 2000
Posts: 28
Time spent in forums: 7 h 47 m 40 sec
Reputation Power: 0
|
|
|
Thx, but escaping the quotations isn't really the problem, I've already done that and they appear fine.
The problem is that the HTML code reads the Text field and closes the Value parameter too soon.
EG: <INPUT TYPE="TEXT" VALUE="<a href="#">link</a>">
The highlighted " closes the Value parameter and whatever follows is left out of the field. So only <a href= appears.
|

June 2nd, 2000, 09:05 AM
|
 |
Senior Member
|
|
Join Date: Jun 2000
Location: Enschede, The Netherlands
Posts: 1,527
Time spent in forums: 2 h 55 m 57 sec
Reputation Power: 14
|
|
Ahh.. I see.. thought you meant something else..
Try this:
<INPUT TYPE="TEXT" VALUE="<a href="#">link</a>">
> Hmm.. even this page sees it as an quote 
> Instead of the quotes type &+quot+; without the + signs
I tested it and it works with me...
[This message has been edited by Mirax (edited June 02, 2000).]
|

June 2nd, 2000, 09:18 AM
|
|
Registered User
|
|
Join Date: Jun 2000
Posts: 28
Time spent in forums: 7 h 47 m 40 sec
Reputation Power: 0
|
|
Cheers.
The quot code works but it's a pain in the *** to type that in every time 
|

June 2nd, 2000, 09:22 AM
|
 |
Senior Member
|
|
Join Date: Jun 2000
Location: Enschede, The Netherlands
Posts: 1,527
Time spent in forums: 2 h 55 m 57 sec
Reputation Power: 14
|
|
Maybe you can convert it automaticaly somehow... it would make a difference indeed 
|

June 2nd, 2000, 09:24 AM
|
|
Registered User
|
|
Join Date: Jun 2000
Posts: 28
Time spent in forums: 7 h 47 m 40 sec
Reputation Power: 0
|
|
|
Yep, I'll look into it.
Also using a <TEXTAREA> instead of an input field is another way around it.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|