vendredi 24 février 2023

Echoing multiple check boxes

I am trying to write some code for a collection form for a fake dating form. I'd like the form, or the 'end' screen repeat back what the user has put in for their information.

I have text fields and radio buttons that I was able to repeat back to the user but for some reason when I do the check box portion of it, it is only repeating back the last answer I gave. (I know this isn't the correct code, but I am currently not knowledgeable about other solutions)

For example, this is what I have coded now, when I select 'men' and 'women'.

                if($_POST['pg'] == 'M') {
                    echo "You are attracted to men"."<br>";
                } else if ($_POST['pg'] == 'F') {
                    echo "You are attracted to women"."<br>";
                } else {
                    echo "You are attracted to gender neutral people"."<br>";
                }

I only receive the echo "You are attracted to women" is there anyway I can get multiple repeated back to me?




Aucun commentaire:

Enregistrer un commentaire