Form action - php pdf - Phptpoint.com

Form action

/ins>

How to use HTML Form action

Action is used to give reference/link of another page.

If we want to separate the business logic (PHP script) from Presentation layer (HTML script) then use action Property of Form .

It reduce the complexity of bulk of codes. Because All scripts are separately define on their own page.

In the previous Form Post method PHP script and HTML script were define on the same page ,so it show the design part with the output of program.

But using action property HTML script define on a separate page and Business logic(PHP script) on another separate page.

Create HTML Form with action Property

Save it as DesingView.php

PHP Script

Save it as Logic.php

First we make Form using HTML script. We design a textbox to take input through user and a submit button with value(“show my name”) .

When name is entered by user and click on submit button the value of textbox redirect to php script page. Because Action Attribute is used here for link .

Information that is send by user is collect by using $_POST[] and store in a local variable($name).

Now a local variable is concatenate with String(“welcome”) and print, output will become Welcome Sanjeev.