Here is the first script:
<html><head><title>Fourth</title></head>
<body>
<center><h3>Registration</h3></center>
<hr>
Please fill your username and password in this registration form below
<form action="five.php" method="post">
<pre>
Nama : <input type="text" name="usrname" size="30" maxlength="30"><br><br>
Password : <input type="password" name="passwd" size="8" maxlength="8"><br><br>
<input type="submit" value="Send Soon!">
</pre>
</form>
</body></html>
In the script above we only apply html codes as we ignore some security aspects for this basic lesson. The most important thing is the parameter action="name.php" method="post" inside form tag, name="usrname" and name="passwd" because those parameters will be catchedby the next file/page.
Save the file as four.php
Next, here is the second script:
<html><head><title>Fifth</title></head>
<body>
<center><h3>Form Destination</h3></center>
<hr>
<h4>Thank you for submitting your registration form</h4>
We have completely received your registration form
<?php
$username = $_POST[usrname];
$passwd = $_POST[passwd];
print("Your username is <b>$usrname</b><br>");
print("Your password is <i>$passwd</i><br>");
?>
</body></html>
The file above must be saved as five.php. Why? It s because a page/file where the first file was addressed (see action="five.php" in the previous script). Then we catch the other two parameters with a command $_POST[...]. We are using "POST" because in the first file we used POST method. Basically we may use POST or GET method.