The first thing we will do is to pass all variables through PHP's htmlspecialchars() function. The below diagram shows the difference between get and post Processing the registration form data. For testing purposes we've removed all the usual JavaScript Form Validation and HTML5 Form Validation so the form can simply be submitted and validated by PHP on the server.. You'll notice that we've used PHP to insert the form action as the current page. I'm not sure I understand what you are trying to achieve as we don't have what username() is supposed to return but you might want to try something like that. in seat php, we are just using echo to display both value, see the code below for form.php and for seat.php, form.php and our form action is seat.php, and name for form file is form.php for this example. Below example contains PHP script to get a single or multiple selected values from given HTML select tag. I am assuming you might be able to do the same in php. Here we've used contact.php, so the form data will be sent to that script. For example, you can define another form field for a number named num3 (thirdnumber) and other operations between num1, num2 and num3 to compare how the php script output will change. tab, window, or inline frame). Not a php guy but in .NET i can just post to one form action and just find out which button was clicked by looking at the form post data. The action attribute in the form determines where the form data needs to be sent. The target attribute defines a name of, or keyword for, a browsing context (e.g. If you don't have an action attribute, the data is sent back to the same URL. Alternatively you would just use javascript to change the target of the submit. When we use the htmlspecialchars() function; then if a user tries to submit the following in a text field: The target attribute specifies a name or a keyword that indicates where to display the response that is received after submitting the form.. I would also recommend you don't echo whole page and rather use something like that, it's much easier to read and maintain: For instance, with a login form, there is typically the login, forgotusername, forgotpassword, signin activities that are presented on the form as buttons or anchors. Since a form can only have a single action, the same PHP script had to handle all four tasks, by identifying which button had been clicked and executing the appropriate code branch. PHP script for SELECT OPTION FIELD: HTML select tag allows user to choose one or more options from the given drop down list. An alternative, and perhaps a not so good procedural coding one, is to send the "function name" to a script that then executes the function. Validate Form Data With PHP. The registration form submits data to itself as specified in the action attribute of the form. Definition and Usage.