Is your server configured to run HTML files as PHP files? You’re trying to run a PHP code inside a HTML file! You should rename index2.html
to index2.php
and run it inside an Apache server, or configure your Apache to run HTML as PHP. Also, index2
must be the action
of index1
form.
UPDATE
How to parse HTML as PHP?
3
solved Capture php variable from (Index1.php) To (Index2.html)