Posted by: Sourav | March 1, 2011

forms in php


The first page named “form.php”

<html>
    <head>
        <title>
            My First Form
        </title>
    </head>
<body>
<h1>A Sample Form</h1>
<?php
echo “$_POST[fullname]. You are from $_POST[address]. Your comments were
$_POST[comments]. <br> “
?>
<br />
<form method=”post”>
Name: <input type=”text” name=”fullname” />
Address: <input type=”text” name=”address” /><br /><br />
Comments: <textarea name=”comments” cols=”40″ rows=”2″></textarea><br /><br />
<input type=”submit” name=”submitbutton” />
<input type=”reset” name=”resetbutton” />
</form>
</body>
</html>

The second or the output page named “result.php”

<html>
    <head>
        <title>
            Result of the form
        </title>
    </head>
    <body>
               
<?php
$username=$_POST[‘username’];
$password=$_POST[‘password’];
echo “Username is “.” $username”.”and password is”.” $password”;

?>
    </body>
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: