#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    28
    Rep 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.

  2. #2
  3. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2000
    Location
    Enschede, The Netherlands
    Posts
    1,527
    Rep Power
    15
    <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
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    28
    Rep 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.
  6. #4
  7. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2000
    Location
    Enschede, The Netherlands
    Posts
    1,527
    Rep Power
    15
    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).]
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    28
    Rep Power
    0
    Cheers.

    The quot code works but it's a pain in the *** to type that in every time
  10. #6
  11. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2000
    Location
    Enschede, The Netherlands
    Posts
    1,527
    Rep Power
    15
    Maybe you can convert it automaticaly somehow... it would make a difference indeed
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    28
    Rep Power
    0
    Yep, I'll look into it.

    Also using a <TEXTAREA> instead of an input field is another way around it.

Similar Threads

  1. help with tables and wordwrapping
    By junkedBrian613 in forum PHP Development
    Replies: 2
    Last Post: February 15th, 2004, 05:42 PM
  2. Updating text fields from dynamic SQL select box?
    By Trent Hatred in forum HTML Programming
    Replies: 3
    Last Post: February 6th, 2004, 10:34 AM
  3. Bizarre problem...
    By TarHeelGrad in forum HTML Programming
    Replies: 0
    Last Post: February 6th, 2004, 09:11 AM
  4. Dynamically naming text fields
    By JCD in forum ASP Programming
    Replies: 0
    Last Post: February 4th, 2004, 05:16 PM
  5. How to read multiple line text file into a variable
    By gatewaycityca in forum Visual Basic Programming
    Replies: 4
    Last Post: January 29th, 2004, 12:26 PM

IMN logo majestic logo threadwatch logo seochat tools logo