Basic program before entering to MySQL with PHP
Here is a simple program which you needed to study before you studying about the manipulations of php with database.
Create the following php file with the following code:
Then create a file named form.php with the following code
This program reads the username and password. It doesn't store the username and password but the username and password that we read is sent a newpage with the post method and displays the username and password.
Since we set the attribute method=" post "so that we can read the values from the form using the $_POST. It reads values using the name of the input box.
Output:
Here the name and password that we entered is transfered to next page via post method.
Create the following php file with the following code:
<html >
<body>
<form action="form.php" method="post">
user name:
<input type="name" name="name">
<br>
password:
<input type="password" name="password">
<br>
<input type="submit">
</body>
</html>
Then create a file named form.php with the following code
<?php
echo "user name:";
echo $_POST["name"]."<br>";
echo "password:";
echo $_POST["password"];
?>
This program reads the username and password. It doesn't store the username and password but the username and password that we read is sent a newpage with the post method and displays the username and password.
Since we set the attribute method=" post "so that we can read the values from the form using the $_POST. It reads values using the name of the input box.
Output:
Here the name and password that we entered is transfered to next page via post method.
⇐Prev
Next⇒
Comments
Post a Comment