How do I get a list of text that needs to have new lines in PHP form?

Viewed 32

I am reworking one of my current HTML pages to pass a list of cards to PHP.

The raw data looks like this:

1 Tall Troll

3 Forests

2 Littleby, The Fish Slayer

These values come in a text file which the user copy and pastes into the text box.

I need a text box on my webpage to paste them in, pull out the quantity and card name, and pass them to variables. I will use the name to find the card price/cost($). The problem is the text box below is a single line, and does not keep the new line breaks. I can't figure out how to keep the data in the same format as the text file. I assume I will need to parse the data after.

Feel free to suggest if I need a dictionary or array.

Current code:

<!Doctype html>

<html>
    <head>
        <title>Circle Calculation</title>
    </head>
    <body>
        <h1>Circle Calculation</h1>

        <form action="putich-html-input.php" method="post">
            <p>Please Paste Your Card List
                <input type = "text" size="300" name="radius"/>
            </p>
            <p>
                <input type="submit" value="Calculate list cost" />
            </p>
        </form>
    </body>
</html>
0 Answers
Related