Tuesday 25 March 2014

Handling Text Fields

First of All make sure that you have PHP or XAMPP, if you don't have then no worries you can get it from here

After Downloading and Installing now you need to do what I'm doing.

In This Tutorial You Have To Make 2 Files.

So Let's Start


Form.html will look like this



<html>
<head><title>Form</title></head>
<body>

<Form method="post" action="Input.php">

First Name: <input type="text" required name="firstname" placeholder="First Name"><BR>

Last Name: <input type="text" required name="lastname" placeholder="Last Name"><BR>

Username: <input type="text" required name="username" placeholder="Username"><BR>

Email: <input type="email" required name="email" placeholder="Email"><BR>

Password: <input type="password" required name="password" placeholder="Password"><BR>

<input type="submit"><BR>

</Form>
</body>
</html>



Now Turn For The Real Thing

Input.php will look like this



<html>
<head><title>Checking Your Details....</title></head>
<body>

<P Align="center">
Here Are Your Details <BR>

<?php

$firstname = $_POST["firstname"];   

$lastname = $_POST["lastname"];

$username = $_POST["username"];

$email = $_POST["email"];

$password = $_POST["password"];

echo "Name: " ,$firstname, "<BR>";      

echo "Username: " ,$username, "<BR>";

echo "Email: " ,$email, "<BR>";

echo "Password: " ,$password, "<BR>";

?>

Are They Correct?<BR>
No? <BR>
No Worries Just <a href="Form.html">Click Here</a> and enter it again<BR>

</P>

</body>
</html>



Remember To Save This File As Input.php

Here's an example


First Name:
Last Name:
Username:
Email:
Password:



After Clicking on Submit it will show Error 404, because I haven't made that file yet.

Now You are Done!

Didn't Understood the code?
No Problem! Just Click Here

Follow Me On My Facebook Account

No comments:

Post a Comment