Jump to content


Photo

Displaying exactly what is in the field...*SOLVED*


  • Please log in to reply
2 replies to this topic

#1 pocobueno1388

pocobueno1388
  • Members
  • PipPipPip
  • Advanced Member
  • 3,369 posts
  • LocationPalm Beach, Florida

Posted 12 September 2006 - 01:18 AM

I have a site where users can put a small picture as their username. There is an area where you can change your username, and a user can input something like:

<img src="image_URL" border=0>

And that exact information as they typed it will be submitted in the database in their 'username' field. The problem I am having is I have an input box that shows their current username, then they can highlight it and change it.
If the user has an image as their name, obviously the input box can only display text and not the image. I would like to make the input box display:

<img src="image_URL" border=0>

EXACTLY like that. How do I just select that from the db without it thinking I am trying to display an image in the input box? Here is the code I am using for the input box currently:

<input type=text name="username" maxlength=255 length=20 value="$player[username]">

It is the value part that needs to be changed...

Any help would be appreciated. Thanks XD

#2 btherl

btherl
  • Staff Alumni
  • Advanced Member
  • 3,893 posts
  • LocationAustralia

Posted 12 September 2006 - 01:47 AM

I think that this is what you want: http://sg.php.net/ma...pecialchars.php

For example:

$username_encoded = htmlspecialchars($player['username']);
print '<input type=text name="username" maxlength=255 length=20 value="' . $username_encoded. '">';


#3 pocobueno1388

pocobueno1388
  • Members
  • PipPipPip
  • Advanced Member
  • 3,369 posts
  • LocationPalm Beach, Florida

Posted 12 September 2006 - 02:02 AM

Perfect =) Thank you so much.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users