How to use form button (PHP super beginner)
Sep 5, 2020
As a PHP super beginner, I stumbled upon creating a form button and will post what I learned from it. What is a ## form tag? Tags used when creating input forms etc.
Set actions and methods.
◉ action attribute = You can specify a program to process the data entered in the form.
- If you enter the url, you can move to that page when you press the button. If not decided, set the “#” symbol.
◉ method attribute = You can set how to send the data entered in the form. Select the value from “get” or “post”.
- If the method attribute is omitted, “get” is entered as the initial value, but normally “post” is used.
Difference between GET and POST
・ GET is used when searching for or acquiring information. ・ POST is used for updating and registration processing.
- Use POST to send highly confidential data.
This article was very easy to understand. https://qiita.com/kanataxa/items/522efb74421255f0e0a1
The mistake I made
I’m not familiar with action and method attributes I made a mistake like this when creating a website.
<form action = "post"> <input type = "submit" name ='message' value ='send> </ form>
Not POSTed at all. .. If you think I was setting POST to the action attribute instead of the method attribute.
<form actio = "#" method = "post"> <input type = "submit" name ='message' value ='send'> </ form>
This is correct.
I hope the super beginners don’t make the same mistakes.