Friday, January 10, 2014

Registration form code

<?php
    include "settings.php";
?>
<html>
<head>
<title> REgistration Form</title>
</head>

<body>
    <form name="information" action="user.php" method="post">

    <table width="274" border="0" align="center" cellpadding="2" cellspacing="0">
    <tr>
    <td colspan="2">
    <div align="center">

        <h1 align="center"> Registration Form</h1>

    </div></td>
    </tr>
    <tr>
    <td width="95"><div align="right">Name:</div></td>
    <td width="171"><input type="text" name="name" /></td>
    </tr>
    <tr>
    <td><div align="right">F.Name:</div></td>
    <td><input type="text" name="fname" /></td>
    </tr>
    <tr>
    <td><div align="right">Email:</div></td>
    <td><input type="text" name="email" /></td>
    </tr>
    <tr>
    <td><div align="right">Date of Birth:</div></td>
    <td><input type="text" name="dob" /></td>
    </tr>
    <tr>
    <td><div align="right">Current Class.:</div></td>
    <td><input type="text" name="currentclass" /></td>
    </tr>
    <tr>
    <td><div align="right">Obtained Marks:</div></td>
    <td><input type="text" name="obmarks" /></td>
    </tr>
    <tr>
    <td><div align="right">Percentage:</div></td>
    <td><input type="text" name="percentage" /></td>
    </tr>
    <tr>
    <td><div align="right">Field Of Study:</div></td>
    <td><input type="text" name="fieldofstudy" /></td>
    </tr>
    <tr>
    <td><div align="right"></div></td>
    <td><input name="submit" type="submit" value="Submit" /></td>
    </tr>


     <?php
                    if(isset($_POST['Registration']))
                    {

                        $name = $_POST['name'];
                        $fname = $_POST['fname'];
                        $email = $_POST['email'];
                        $dob = $_POST['dob'];
                        $currentclass = $_POST['currentclass'];
                        $obmarks = $_POST['obmarks'];
                        $percentage = $_POST['percentage'];
                        $fieldofstudy = $_POST['fieldofstudy'];
               

                        if(!$name || !$fname || !$email || !$dob || !$currentclass || !$obmarks || !$percentage || !$fieldofstudy )
                            echo "Please enter all the values to sign up";
                        else
                        {
                            $sql = "INSERT INTO information VALUES ('', '$name','$fname','$email' , '$dob','$currentclass','$obmarks' , '$percentage','$fieldofstudy')";
                            $query = mysql_query($sql);
                            if($query)
                                echo "Registered successfully";
                            else
                                echo "Failed. There was an error while registering you.";
                        }
                    }

    </table>
    </form>





</body>
<html>

Click on Download below to get the file///////////


0 comments:

Post a Comment