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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print in xxx,xxx.xx form?

Status
Not open for further replies.

MichaelLewis

Programmer
Feb 5, 2011
12
FR
I do $Bal = ($Bal - $row[3]) and then, to print the results,

<input readonly size=\"10\" style=\"color:black;text-align:right\" value=\"$Bal\">

But how do I get the format xxx.xxx.xx?

Thanks,
Michael
 
It looks like your using PHP. Perhaps you should ask the PHP Forum, but...
-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
I disagree. "<input..." is an HTML tag.

Nevertheless I looked at the reference you gave me and tried it but it doesn't make any difference. I presume because that's a PHP matter but the "<input..." which prints the amount is HTML.

Is there not a way of defining the print format in the "<input>" tag?

Thanks,
Michael
 
Is there not a way of defining the print format in the "<input>" tag?
Nope.

Home > Forums > Programmers > Web Development > HTML, XHTML & CSS Forum
How to print in xxx,xxx.xx form?
thread215-1643421
Forum Search FAQs Links Jobs Whitepapers Forum MVPs
Read
New Posts Reply To
This Thread Start A
New Thread e-mail
E-mail It print
Print Next
Thread
New PostMichaelLewis (Programmer)
29 Mar 11 19:26
I do $Bal = ($Bal - $row[3]) and then, to print the results,

<input readonly size=\"10\" style=\"color:black;text-align:right\" value=\"$Bal\">

But how do I get the format xxx.xxx.xx?

Thanks,
Michael

Thank MichaelLewis
for this valuable post!


Inappropriate post?
If so, Red Flag it!


Check out the FAQ
area for this forum!

Check Out Our Whitepaper Library. Click Here.
New PostGeates (Programmer)
29 Mar 11 20:19
It looks like your using PHP. Perhaps you should ask the PHP Forum, but...
-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon


Thank Geates
for this valuable post!


Inappropriate post?
If so, Red Flag it!


Check out the FAQ
area for this forum!

New PostMichaelLewis (Programmer)
30 Mar 11 11:43
I disagree. "<input..." is an HTML tag.
Certainly is! HOWEVER
This ->
Code:
value=\"$Bal\">
is PHP code!


Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Whoops! Bit of an excessive copying going on there!

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
There is no way to define format in the html input tag, you need to do that from your PHP code.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Behind the Web, Tips and Tricks for Web Development.
 
I wasn't referring to the <input> tag. The other code you provided is PHP

PHP
Code:
$bal = $bal - $row[3])
[red]$bal = number_format($bal, 2, ".", ",")[/red]

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
OK. Shame on me. I should not argue with the masters.

I thought the whole of the "<input..." tag was HTML.
Also, I had tried the number_format and it didn't work - I must have had an error and didn't see it. I must admit I was a bit rushed at the time.

I've tried it again under more calm circumstances and it works fine. ( It's easy when one does it right!)

Again, many thanks for you patient help.
Michael
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top