0% found this document useful (0 votes)
47 views5 pages

Student Registration Form

The document contains a student registration form with fields for name, address, city, gender, hobbies, date of birth, mobile number, email and password. It also has a validation page that checks the required fields and data formats on form submission.

Uploaded by

userdemo12334
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views5 pages

Student Registration Form

The document contains a student registration form with fields for name, address, city, gender, hobbies, date of birth, mobile number, email and password. It also has a validation page that checks the required fields and data formats on form submission.

Uploaded by

userdemo12334
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Student Registration Form

Stud.php

<html>

<head>

<title>Sample Form</title>

</head>

<body bgcolor="grey">

<center>

<marquee behavior=alternate>

<h1>----Student Registration Form----</h1>

</marquee><br>

<form name="form1" method="POST" action="valid.php">

<table border="1" bgcolor="pink">

<tr>

<td>Enter Name :- </td>

<td><input type="text" name="txtname" required></td>

</tr>

<tr>

<td>Address :- </td>

<td><textarea cols="30" rows="5" name="txtadd" required></textarea></td>

</tr>

<tr>

<td>City :- </td>

<td><select name="selcity" required>

<option value="">---Select City---</option>

<option value="Surat">Surat</option>

<option value="Valsad">Valsad</option>

<option value="Navsari">Navsari</option>

</select></td>
</tr>

<tr>

<td>Gender :- </td>

<td><input type="radio" name="gender" value="Male">Male

<input type="radio" name="gender" value="Female">Female</td>

</tr>

<tr>

<td>Hobbies :- </td>

<td><input type="checkbox" name="reading" value="Reading">Reading

<input type="checkbox" name="playing" value="Playing">Playing

<input type="checkbox" name="dancing" value="Dancing">Dancing

</td>

</tr>

<tr>

<td>DOB :- </td>

<td><input type="text" name="date" required></td>

</tr>

<tr>

<td>Mobile Number :- </td>

<td><input type="text" name="mobile" required></td>

</tr>

<tr>

<td>Email Id :- </td>

<td><input type="email" name="email" required></td>

</tr>

<tr>

<td>Password :- </td>

<td><input type="password" name=""></td>

</tr>

<tr>

<td><input type="submit" name="txtsubmit" value="Submit">


<input type="reset" name="reset" value="Reset"></td>

</tr>

</table>

</form>

</center>

</body>

</html>

Valid.php

<?php

$Name=$_POST['txtname'];

$Address=$_POST['txtadd'];

$City=$_POST['selcity'];

$Gender=$_POST['gender'];

$Hobbies="";

if (isset($_POST['reading']))

$Hobbies=$_POST['reading'];

if (isset($_POST['playing']))

$Hobbies=$Hobbies.$_POST['playing'];

if (isset($_POST['dancing']))

$Hobbies=$Hobbies.$_POST['dancing'];

}
$DOB=$_POST['date'];

$Mobile=$_POST['mobile'];

$Email=$_POST['email'];

if(empty($Name))

echo "Name can't be empty <br>";

elseif (!preg_match('/^[a-z]*[a-z]$/',$Name))

echo "Name must be in small letter <br>";

if(empty($DOB))

echo "DOB can't be empty <br>";

elseif (!preg_match ('/^(0[1-9]|[12][0-9]|3[01])[-\/\.](0[1-9]|1[012])[-\/\.](19|20)[0-9]{2}$/',$DOB))

echo "Date must be in dd-mm-yyyy format <br>";

if(empty($Mobile))

echo "Mobile number can't be empty <br>";

elseif (!preg_match ('/^[0-9]{10}$/',$Mobile))

echo "Mobile number must be in 10 digit <br>";

if(isset($_POST['txtsubmit']))

echo "Name :- $Name"."<br>";


echo "Address :- $Address"."<br>";

echo "City :- $City"."<br>";

echo "Gender :- $Gender"."<br>";

echo "Hobbies :- $Hobbies"."<br>";

echo "DOB :- $DOB"."<br>";

echo "Mobile :- $Mobile"."<br>";

echo "Email Id :- $Email"."<br>";

echo "Record Inserted Successfully";

?>

You might also like