| | |
Use form data in substr?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2008
Posts: 23
Reputation:
Solved Threads: 0
Hello again, I previously asked a question about how to seperate text in a form. I understand how to do that now (thanks KKeith29), but my question now is this: How do I use the data entered in the form for the variable I want to perform the substr on? I've tried some different things and can't come up with anything. Once again, I'm sure it's simple but I just don't have the experience yet.
Just to clarify if anyone is lost: User inputs 4D27H2H111111 into form field. The data is submitted. I want that submitted info to be the variable upon which I use substr to seperate it into different pieces so I can then run it through the database.
Thanks again everyone,
Arthur Ash III
Just to clarify if anyone is lost: User inputs 4D27H2H111111 into form field. The data is submitted. I want that submitted info to be the variable upon which I use substr to seperate it into different pieces so I can then run it through the database.
Thanks again everyone,
Arthur Ash III
$variable = $_POST['form_variable_name']; More about it here. http://w3schools.com/php/php_post.aspYou should sanitize user's input by using mysql_real_escape_string or addslashes .
Ignorance is definitely not bliss!
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Apr 2006
Posts: 66
Reputation:
Solved Threads: 11
Hello,
Maybe i didn't understand very good your problem, but i think that the first think you should do is to force users to input text following a pattern defined by you (or at least to explain how to enter the text). to be clear, for example your provided text 4D27H2H111111. will you always have 6 digits at the end of the string? then ... first 7 characters will be treated as a whole string or you want to perform some other action about this too. i think the easiest way, is to use "-" (for example, or blank space) and use explode (or split) to have access to your desired info.
All the best,
Maybe i didn't understand very good your problem, but i think that the first think you should do is to force users to input text following a pattern defined by you (or at least to explain how to enter the text). to be clear, for example your provided text 4D27H2H111111. will you always have 6 digits at the end of the string? then ... first 7 characters will be treated as a whole string or you want to perform some other action about this too. i think the easiest way, is to use "-" (for example, or blank space) and use explode (or split) to have access to your desired info.
All the best,
![]() |
Similar Threads
- How To Create A Free Web Host (PHP)
- Parsing html form. (PHP)
- Php Mysql Image Question (PHP)
- Please help!!! Upload script.. (PHP)
- Get querystring (JavaScript / DHTML / AJAX)
- Problems in Dynaform (Form Mail) URGENT HELP (PHP)
- Hello Dani Web members (PHP)
- Form not sending email (PHP)
Other Threads in the PHP Forum
- Previous Thread: How to return a mysql result set
- Next Thread: login page redirects to itself as a loop:
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions simple sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube






