Pass the html input value parameter with php

Asked

Viewed 574 times

-1

Good night How do I pass html input parameter and send by parameter to receive in php. When submitting if the field is empty then it has to call the function identifies which field. Follow the code below: insert image description hereinserir a descrição da imagem aqui

inserir a descrição da imagem aqui

In Php, before insertion I am doing so inserir a descrição da imagem aqui is that inclusion=2 means you have field to fill in, so there in html is verified that, returned via get.

  • Hello! Use your code in the content of your question. Do not put code image, but pure code. I recommend reading: How to ask a good question? https://answall.com/help/how-to-ask Greetings.

  • Send and validate using javascript.

1 answer

1

The correct thing would be for you to put these inputs into a form by setting a "name" for each field and an action for the form, you will use $_Post to capture the values. Remembering that you capture the value according to the "name" you determined in the input. Follow the examples: http://php.net/manual/en/tutorial.forms.php

After you capture the information, you can do the checks as you see fit. For example, if a field comes null, you can put a condition and return an echo containing the error to the user.

You could also use HTML5 to address this issue, if you put the "required" tag inside the input, if the user does not fill it in, a message will be displayed.

I hope I’ve helped you, in case there’s any doubt, I’m willing to help you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.