PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 30th, 2005, 08:23 PM
blindmonkey blindmonkey is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 19 blindmonkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 28 sec
Reputation Power: 0
Angry Dollar Sign issues

Hello fellow DevShedders,

I have a wee little script (only 109kb or so) that has a little problems. The script e-mails a quote for a price to the user. The only problem the script is having is within the e-mail. I am using a Windows system, so I'm using number_format for the dollar amount. I use a code something like this:

echo "Your price is $".number_format($price, 2, ".", ",")." for you item.";

The problem is that when this is appearing in the e-mails, it appears as follows:

Your price is \$19.55 for your item.

I've tried str_replace to get rid of the "\" character, but to no avail. Is there any way to ensure that the \ will not be automatically put in by PHP?

I decided to give this issue to the experts... You!

Sincerely,
Confused blind monkey.

Reply With Quote
  #2  
Old June 30th, 2005, 08:27 PM
E D D ! 3 E D D ! 3 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: /home/eddie/.secret
Posts: 273 E D D ! 3 User rank is Corporal (100 - 500 Reputation Level)E D D ! 3 User rank is Corporal (100 - 500 Reputation Level)E D D ! 3 User rank is Corporal (100 - 500 Reputation Level)E D D ! 3 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 5 Days 11 h 34 m 3 sec
Reputation Power: 8
Send a message via AIM to E D D ! 3
use \ before any symbols that have a actual use in php or anything of the sort.

Reply With Quote
  #3  
Old June 30th, 2005, 08:32 PM
Drax Drax is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 78 Drax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 h 18 m 4 sec
Reputation Power: 6
try using stripslashes($str);

Reply With Quote
  #4  
Old June 30th, 2005, 10:00 PM
blindmonkey blindmonkey is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 19 blindmonkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 28 sec
Reputation Power: 0
Thumbs up backslashes

I do use backslashes before symbols, but whether I do or not, PHP will include them in the e-mail body no matter what. I'll try the slash stripping function and see if that clears them. Thanks for the advice.

Reply With Quote
  #5  
Old July 3rd, 2005, 10:27 AM
todd32586 todd32586 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Location: St. Louis, MO
Posts: 13 todd32586 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 43 m 22 sec
Reputation Power: 0
Try:

echo 'Your price is $'.number_format($price, 2, ".", ",").' for you item.';


The single quotes make PHP treat $ as any other character, not a variable.

Reply With Quote
  #6  
Old July 3rd, 2005, 11:09 AM
Sepodati's Avatar
Sepodati Sepodati is offline
Banned
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Dec 1999
Location: Kentucky
Posts: 14,429 Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)Sepodati User rank is General 23rd Grade (Above 100000 Reputation Level)  Folding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced FolderFolding Points: 97169 Folding Title: Advanced Folder
Time spent in forums: 3 Months 1 Day 17 h 28 m 10 sec
Reputation Power: 2546
Send a message via ICQ to Sepodati Send a message via Yahoo to Sepodati
Quote:
Originally Posted by blindmonkey
I use a code something like this:

echo "Your price is $".number_format($price, 2, ".", ",")." for you item.";
(emphasis mine)

So what is the actual code you're using, because that code you gave will not add a slash before the dollar sign. You must be doing something else to the string in order for the slash to appear.

---John Holmes...

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Dollar Sign issues


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump



 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT