[SOLVED] making sure characters saved to db remain in the long version, like '£

This is a discussion on "[SOLVED] making sure characters saved to db remain in the long version, like '£" within the PHP Forum section. This forum, and the thread "[SOLVED] making sure characters saved to db remain in the long version, like '£ are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Nov 30th, 2007, 23:39
Up'n'Coming Member
Join Date: May 2007
Location: northern nsw, au
Age: 27
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] making sure characters saved to db remain in the long version, like '£

hi there, I have a cms and whenever I save a character like &pound to the db and then retrieve it to an editable field again, when it displays in the input, naturally it just displays the actual character and not the longwinded version.

I am wondering if there is a way around this? I don't like the idea of having to each time I want to save something back to the db doing some ereg_replace() script that changes everything as I'd like to keep the character input manual at this stage.

Any ideas?
Reply With Quote

  #2 (permalink)  
Old Nov 30th, 2007, 23:42
Up'n'Coming Member
Join Date: May 2007
Location: northern nsw, au
Age: 27
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: making sure characters saved to db remain in the long version, like '£'

To keep it simple, when I save £ to a mysql table and retrieve it to a text input again, i'd like it to output as £ and not actually display the pound symbol.
Reply With Quote
  #3 (permalink)  
Old Dec 1st, 2007, 03:33
Rakuli's Avatar
SuperMember

SuperMember
Join Date: Sep 2007
Location: Australia
Age: 24
Posts: 956
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Re: making sure characters saved to db remain in the long version, like '£'

When you write the value to the form element use

PHP: Select all



html_entities
($text); 
And it will be converted to html entities and displayed literally
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Reply With Quote
  #4 (permalink)  
Old Dec 1st, 2007, 03:54
Up'n'Coming Member
Join Date: May 2007
Location: northern nsw, au
Age: 27
Posts: 76
Thanks: 0
Thanked 0 Times in 0 Posts
Re: making sure characters saved to db remain in the long version, like '£'

Nice one Rakuli. Thank you.

htmlentities($text) ended up doing the trick!
Reply With Quote
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] cookie does not get saved thosecars82 JavaScript Forum 2 May 23rd, 2008 12:13
[SOLVED] fread only reading 78 characters CloudedVision PHP Forum 2 Apr 7th, 2008 20:50
Read First 3 characters and last 4 characters of string JustinStudios PHP Forum 2 Apr 4th, 2008 00:01
[SOLVED] not processing or just taking too long saltedm8 PHP Forum 3 Oct 17th, 2007 12:59
[SOLVED] How To: Change characters in a textarea? Using Javascript Anonymous User JavaScript Forum 0 Feb 16th, 2005 12:34


All times are GMT. The time now is 11:30.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43