As mentioned in the earliar example, we can put the php script in a separate file.form.html
<html> <body> <form action="form4.php" method="post"> Name: <input type="text" name="name"><br> E-mail: <input type="text" name="email"><br> <input type="submit"> </form> </body> </html>
Below here the separate php script file.form4.php
<?php $your_name = $_POST["name"]; $your_email = $_POST["email"]; echo "Welcome " . $your_name."<br>"; echo "Your Email is " . $your_email; ?>
You can try to run the page here.
The warning would not have been generated if we have 2 separate files.
Put the form.html and form4.php in the same directory, run the form.html above and it will call out the form4.php in a different file.