jeudi 11 mars 2021

Trying to create a string value from a checkbox that also has a user input

I'm new to this if you can't tell by the absurdity of this post, but I'm trying to make something that will take the results of a checkbox and match each option with a numerical value that the user types in. So this is what my interface looks like.

My GUI

I want to be able to make an Order variable from the Order using PHP and make it look something like this when the variable is printed.

2 Filler Choice E, 1 Filler Choice F

Any help would be great and I'm also open to suggestions of how I could do this better because I'm sure this method looks abysmal.

This is my code

<div class="container">
                <b><p>Would you like to pre-order any food?</p></b>
                    <p><input type="checkbox" name="Order[]" value="Filler Choice E - $100" /> Filler Choice E - $100/Quantity: <input type="number" name= "Quantity5" min="1" max="10"/></p>
                    <p><input type="checkbox" name="Order[]" value="Filler Choice F - $100" /> Filler Choice F - $100/Quantity: <input type="number" name= "Quantity6" min="1" max="10"/></p>
                    <p><input type="checkbox" name="Order[]" value="Filler Choice G - $100" /> Filler Choice G - $100/Quantity: <input type="number" name= "Quantity7" min="1" max="10"/></p>
                    <p><input type="checkbox" name="Order[]" value="Filler Choice H - $100" /> Filler Choice H - $100/Quantity: <input type="number" name= "Quantity8" min="1" max="10"/></p>
        </div>



Aucun commentaire:

Enregistrer un commentaire