Reapproving forms in php

1

I'm working on a PHP site where I have about 20 different pages that have the same form. Currently this site has the same code for the form in the 20 pages (ctrl + c / ctrl + v). Is there a way to use the same form in these 20 pages in a simpler way? I'm not used to PHP.

    
asked by anonymous 03.10.2014 / 19:31

1 answer

4

What you need to do is create a php file (for example formulario.php ) with only the form code and then include it in the 20 files.

So you just need to change the code in one place, and in the 20 files you just need to do it:

<?php include('/formulario.php' ); ?>

link

This is very common in parts of the site that are common, such as headers, menus, or footer. This technique is often used to include files that only have functions that are useful and common to specific pages.

    
03.10.2014 / 19:35