• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 549
  • Last Modified:

posting £ symbol as £

How do I post a £ symbol into a mysql table field as the html equivalent?

i.e. £

as currently the value posted is £25K

Why does it add the "Â"?
0
petewinter
Asked:
petewinter
  • 6
  • 4
  • 3
  • +1
2 Solutions
 
svgmucCommented:
Enable latin1 and you should be able to use the UK pound sign.
0
 
Gurvinder Pal SinghCommented:
use £ for pound symbol

see this table
http://www.ascii.cl/htmlcodes.htm
0
 
leakim971PluritechnicianCommented:
Before posting, (use the onsubmit attribute of your form for example) you may use the function HTMLentities(texte) from here : http://www.editeurjavascript.com/forum/topic,2,39285,0.html
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
petewinterAuthor Commented:
So when I post the value do I need to wrap this code with something?

$_POST["salary"]
0
 
Gurvinder Pal SinghCommented:
You don't have to decode it back it, if you use the html code £
 
0
 
petewinterAuthor Commented:
How can I do that?

In the form text field users will just enter "£"? How can I convert it to £ ?
0
 
Gurvinder Pal SinghCommented:
0
 
petewinterAuthor Commented:
Does that make sense?

Users are entering the £ symbol in a text field and I need it to be entered into my mysql database as £
0
 
Gurvinder Pal SinghCommented:
how does it matter what you enter in database at first place, since it will show £ symbol again when you will fetch it back from database?



0
 
leakim971PluritechnicianCommented:
>Users are entering the £ symbol in a text field and I need it to be entered into my mysql database as £

Use :

myform.onsubmit = function() {
      //var salary = document.getElementById("salary");
      var salary = document.getElementsByName("salary")[0];
      salary.value = encodeURIComponent(HTMLentities(salary.value));
}

Open in new window

0
 
petewinterAuthor Commented:
The problem is it gets entered as "£" for some reason instead of "£" Any idea's why it does this?
0
 
leakim971PluritechnicianCommented:
£ -> utf8

Use the same format everywhere : in your page, your database, server language
Should be UTF-8 to avoid this type of problem
0
 
petewinterAuthor Commented:
I just change the field collation to utf8_unicode_ci , but still the same problem?
0
 
petewinterAuthor Commented:
Thanks you have made me realise where I am going wrong.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 6
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now