12 Registration Form PHP

 12.Create Website Registration Form using textbox, checkbox, radiobutton, select, submit button. And display user inserted value in new PHP page.

Note:- two program

01-registration

02-form

save registration.php

program:-01 

 <html>
<head>
<title>Registration</title>
<style>
.main
{
 width:30%;
 margin:2em auto;
 border:2px solid black;
 padding:1em;
}
.main input[type="submit"]
{
 width:95%;
 border:1px solid black;
 padding:.5em;
 margin:.5em;
}
.main input[type="password"]
{
 width:95%;
 border:1px solid black;
 padding:.5em;
 margin:.5em;
}
.main input[type="text"],.main input[type="email"]
{
 width:45%;
 border:1px solid black;
 padding:.5em;
 margin:.5em;
}
</style>
</head>
<body>
<div class="main">

 <form method="post" action="form.php">

 <h2>Student Registration</h2>

  <input type="text" name="fname" placeholder="First Name">
  <input type="text" name="lname" placeholder="Last Name">
  <input type="email" name="email" placeholder="Email">
  <input type="text" name="mobile" placeholder="Mobile">
  <input type="text" name="city" placeholder="City"><br>
<hr>
  Gender<br>
  <input type="radio" name="gender" value="Male">Male<br>
  <input type="radio" name="gender" value="female">Female<br>
<hr>
  Hobbies<br>
  <input type="checkbox" name="hobby[]" value="Cricket">Cricket<br>
  <input type="checkbox" name="hobby[]" value="Football">Football<br>
  <input type="checkbox" name="hobby[ ]" value="Chess">Chess<br>
<hr>
  <input type="Password" name="pass" placeholder="Password"><br>
  <input type="submit" name="submit" value="Register">
 </form>
</div>
</body>
</html>

 

save form.php

program:-02

<?php
 if(isset($_POST['submit']))
 {
  $fn=$_POST['fname'];
  $ln=$_POST['lname'];
  $em=$_POST['email'];
  $mob=$_POST['mobile'];
  $city=$_POST['city'];
  $gender=$_POST['gender'];
  $hobies=$_POST['hobby'];
  $pass=$_POST['pass'];

  echo "First name : $fn <br><br>";
  echo "Last name : $ln <br><br>";
  echo "Email : $em <br><br>";
  echo "Mobile : $mob <br><br>";
  echo "City : $city <br><br>";
  echo "Gender : $gender <br><br>";

  echo "<h3>Hobbies</h3>";

  $i=0;

  while($i<sizeof($hobies))
  {
   echo $hobies[$i]."<br>";

   $i++;
  }
 }
?>

output:-01



 


 

 

Comments

Popular posts from this blog

digital marketing ppt-u1

SOFTWARE

cn lab

Computer Operations and Performing - D L Unit-1-1

DBMS Degree Lab Records

DS-Record-mca-04) write a program for evaluating a given postfix expression using stack.

Java unit-1 history , C++ vs Java , java environment

Access the Internet to Browse Infromation & E-Mail Operation- D L Unit-2-1

OAT-Record-01) Visiting card

java program structure,java Tokens, keywords,