Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

£ signs not passing through on html form 1

Status
Not open for further replies.

Katie6

Programmer
Jun 12, 2007
58
GB
Hi, I have made an html form. It contains the following code:

Code:
<label for="POTENTIAL_LOSS">Potential Loss:</label>
<input name="POTENTIAL_LOSS" id="POTENTIAL_LOSS" type="text" value= "" tabindex="30" />
<br />

When words (e.g. hello world) are entered into the text box, both words pass through to the database as expected. However, if I enter £27.00, the value in the database is 7.00 - it removes the £2 from the beginning.

I know this is not a problem with the SAS code I'm using to write to the database because I have run it in SAS without the html and it works fine. I must have done something silly in my html code.

Can anyone tell me what is wrong with my code or what I have left out?

Many thanks for any help.

Katie.
 
The problem might have to do with the data type of your table/database column that is probably set to DECIMAL. It should be something like TINYTEXT for example.

But if you plan to do price calculations, I suggest that you leave it as it is and store the currency in a different column.
 
Thanks Sleidia, but I know it's not a problem with the data type in the column as when I enter the data through SAS rather than through the html form, it works fine. So my dataset contains £27.00 in the column from when I submitted it from SAS, but it is only when I submit it through the form that it fails. The data type is character. There is no reason why it wouldn't be able to accept numbers or £ signs.
 
Then, you might try to look at the server-side code that stores the data taken from the form. There must be some cleaning up going on there.

I assure you there is no way plain html could prevent you from using that character in a form field.
 
Nothing is wrong with your HTML... it's fine.

To debug this further, I would check to see if the data is correctly stored in the database (if not, then echo out the database query that writes the data into the database and analyse it for errors).

It could very well be that the database is the point of failure here.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Ok, thanks - as long as you're happy that my html is correct. I'm happy that the dataset is correct, but at least I can start thinking of other options.
Many thanks :)
 
Just let me hilight this one line from my post:
...To debug this further, I would check to see if the data is correctly stored in the database (if not, then echo out the database query that writes the data into the database and analyse it for errors).
Can you confirm that the data in the database is correct when you submit it from the HTML form.

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Hi there,

I've done a few tests to see what's happening. I have entered $54.00 into the form and this passes through perfectly to my database, but £54.00 does not. Do you think it might be anything to do with charsets? I had the following at the top of my page originally when it didn't work:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title> DERIC Update Case</title>
<meta name="Author" content="Katie Beedham" />
<meta name="Keywords" content="Cascading, Style, Sheets, CSS1, CSS2, CSS" />
<meta name="Description" content="CSS ~ Cascading Style Sheets" />

I changed the charset to ISO-8859-1 and it still doesn't work.

Grrrr! This is so frustrating!

Thanks for your assistance Jeff, and thanks for any other suggestions. I am convinced it is an html issue now that I have found that $ works. Also, £ signs are able to be stored in the database, just not when submitted through the web.

Thanks again,

Katie
 
Well, try sending through an accented e character: é and see if that safely comes back through from the back-end. If it doesn't, then you may not have UTF8 enabled in the database!

What back-end language are you using? JSP, PHP or something from M$?

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
I am convinced it is an html issue now that I have found that $ works.

Just to repeat what has already been said:

Debug the server-side. Find out what your form is sending to the server-side, and then you will know if your problem is with the HTML or not.

Stop guessing that it is, and debug the issue!

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Hi Jeff,

I'm using the SAS language. Your suggestion that I might not have UTF8 enabled in the database is a good one. I will try to look into this.


And hi Dan,

I have been asked to make a dynamic html form which can write to a SAS database, and although I knew static-type html and CSS before I started, I've only been doing dynamic pages (using SAS) for 2 months and I had to learn SAS from scratch. So I don't know how to 'find out what your form is sending to the server-side'. I thought it meant submit the data using SAS rather than via the form, and when I do this the characters are entered correctly. But perhaps I have misunderstood this.

If I had a chioce, I would be using php and sql, because more people know these, but I am in a department of SAS coders who know nothing about html but want to use the web to enter data into a SAS database.

Many thanks for your suggestions.

Katie
 
And what does your form tag look like?

___________________________________________________________
[small]Do something about world cancer today: PACT[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top