Parsing html form textarea with php?

Caporegime
Joined
12 Mar 2004
Posts
29,919
Location
England
So I have a html form that is a textarea and I want to parse the input using php when it's submitted.

The textarea can be any number of rows and columns like this.

Code:
Spodumain    2,162    Spodumain            34,592 m3
Bright Spodumain    67    Spodumain            1,072 m3
Gecko    21    Combat Drone            1,050 m3
250mm Railgun II    6    Hybrid Weapon    Medium    High    60 m3
Strip Miner I    2    Strip Miner        High    50 m3
What I want to do is to look at each row, and take all the characters from the row and put it into a string, until I hit a number in the row, then take all the numbers (ignoring commas) and put that into a string until I hit whitespace.

Then I can see if each word string is in the database and if so take the value associated with it in the database and multiply it by the number I've taken from the row, to create a calculator of sorts.

In JSP this was pretty easy just using a java class to do it, but I'm not sure what functions to use in php?
 
Back
Top Bottom