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

10 Years
Discussion Span
Last Post by silviuks


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,

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.