PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 2nd, 2000, 08:30 AM
Sidane Sidane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 28 Sidane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.


Reply With Quote
  #2  
Old June 2nd, 2000, 08:42 AM
Mirax's Avatar
Mirax Mirax is offline
Senior Member
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2000
Location: Enschede, The Netherlands
Posts: 1,527 Mirax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #3  
Old June 2nd, 2000, 08:48 AM
Sidane Sidane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 28 Sidane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
  #4  
Old June 2nd, 2000, 09:05 AM
Mirax's Avatar
Mirax Mirax is offline
Senior Member
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2000
Location: Enschede, The Netherlands
Posts: 1,527 Mirax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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).]

Reply With Quote
  #5  
Old June 2nd, 2000, 09:18 AM
Sidane Sidane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 28 Sidane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #6  
Old June 2nd, 2000, 09:22 AM
Mirax's Avatar
Mirax Mirax is offline
Senior Member
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Jun 2000
Location: Enschede, The Netherlands
Posts: 1,527 Mirax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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

Reply With Quote
  #7  
Old June 2nd, 2000, 09:24 AM
Sidane Sidane is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 28 Sidane User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Problem with quotations in Text Fields

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap