Hello friends, this is my 14th tutorial of PHP and Today I am sharing the concept of form processing in PHP. Forms are almost useeverywhere. Forms are the simple and convenient way ask your user to provide a certain set of data. Forms are very simple to design and implement in PHP. In PHP we can easily process the form data. Let me demonstrate this with an example.
Creating a simple form :
Form.html
<form action="process.php" method="post">
Username:<input type="text" name="username" value="">
Password:<input type="password" name="password" value="">
<input type="submit" name="submit" value="Submit">
</form>
Processing the data entered in the form by using a simple enough PHP script :
 Process.php
<?php  
//Fetching data using Post method
$username=$_POST['username'];
$password=$_POST['password'];
echo "{$username} : {$password}";

//Fetching data using Get method
$username=$_GET['username'];
$password=$_GET['password'];
echo "{$username} : {$password}";
?>

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.