homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

send price such as 1000.50 using a form

 4:54 pm on Jan 16, 2013 (gmt 0)

Been searching and trying,
I need to insert a price in a form to later insert into a mysql column wich is decimal(10,2).
The price needs to be like:
1000 or
1000.00 or
Instead of 1 inputs wich looks more complicated to me I am trying to uso 2 inputs, wich I then join like this:
$holidaycost = $price.".".$decimal;
then I check the inputs with ctype_digit to check that only numbers where filled in.
It works perfect, however if the second input is left empty then I need to convert the empty field to 0, wich I cant manage.
Any ideas?



 9:59 pm on Jan 16, 2013 (gmt 0)

I think I should use one input and then format the price correctly.
I ever used filters or regex, and I think this is the filters I need to change 1.001.50 to 1000.50 however it does not work,
what am I doing wrong?
echo $var;

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved