, in the form, each input box has a">
I have a form that contains input boxes of type number, each input box has a corresponding label. I'd like to add a "review page" after submitting the form where you can see your answers to each input box (although you don't need to fill out all of them), just like you are sorting the tags. For example, if I write 4 in the input box labeled "Mark Twain", I want to display "Choice 4: Mark Twain". I cannot change the format to, where in the form each input box has a unique label.
I set each input box in HTML to:
I tried the following code in PHP:
if (isset($_POST["num_a"])) {$a= "Mark Twain"; echo "Choice ", $_POST["num_a"], ":", $a, "
";}
This method works well when num_a is actually input. However, even if num_a is not filled in, it always appears on the review page, so it looks like this:
"Choice: Mark Twain"
What can I do to only display the input box when it has a value? So that only the input box where numbers are entered will appear?
If the input is empty, the input will not be printed.
Since
0
is not a valid input value, you can simplify to: