Need to pass numeric values from user input in dynamically created drop down lists which are then posted. Because they are dynamically generated, they can not be set to a session variable before use. From what I can tell you can only pass non-numeric data via post. I need to be able to pass numeric strings i.e. (9,2) think defining length of say a DECIMAL in a MySQL column, (15, 5, xxx, ..., n) as well as just (n).
What are my options for this?
Pass Numeric Values From Form
Moderator: General Moderators
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: Pass Numeric Values From Form
Correct, any post, get, or cookie data transmitted over HTTP will be a string.
However, if you are passing the data through a POST, you can cast the data to the type that you want before say, inserting into a database.
I dont understand this comment, it sounds like a conflicting ideology:
However, if you are passing the data through a POST, you can cast the data to the type that you want before say, inserting into a database.
I dont understand this comment, it sounds like a conflicting ideology:
a numeric string is just a string as far as I am concerned.edziffel wrote:I need to be able to pass numeric strings i.e. (9,2)
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: Pass Numeric Values From Form
You can also use is_numeric() to see if value received from G,P or C (get, post or cookie) is indeed a numeric value.The Manual wrote:Numeric strings consist of optional sign, any number of digits, optional decimal part and optional exponential part.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
- flying_circus
- Forum Regular
- Posts: 732
- Joined: Wed Mar 05, 2008 10:23 pm
- Location: Sunriver, OR
Re: Pass Numeric Values From Form
Huh, well I learned something newsocial_experiment wrote:The Manual wrote:Numeric strings consist of optional sign, any number of digits, optional decimal part and optional exponential part.