Skip to content
Advertisement

Send data from a check label

Good day, I’ve the following problem, I’m making a form that I sent the data to a Gmail email, the problem is that when choosing a plan, the page throws an error. The mail arrives without any inconvenience and the selected plan but, the page remains with the error. Here I take the data and organize it to be prepared to be sent to Gmail. I’m using the PHPMailer library

$mail->Body = "<h3>Nombre : $nombre <br>Empresa : $empresa <br>Direccion : $direccion 
    <br>Contacto: $contacto <br>Email: $email <br>Ciudad : $ciudad 
    <br>PlanA : $planA <br>PlanB : $planB <br>PlanC : $planC <br>PlanD : $planD </h3>";

This is the error that marks the page

And This is what I have in the HTML part

When sending them, the error on the page jumps. Is there any way to fix it?

Advertisement

Answer

Instead of name for the radio inputs for uno, dos, tres, quatro; you should have these set as value.

The name should be set to something like “plan” for all four.

With a radio input selection, you expect only one option in the group to be chosen.

If you’re checking for each of the four options to be received when the form is posted, any that are not selected won’t be sent to your script and it will throw an error (if you’re referencing them as though they are all passed in).

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement