Aparna Priyadarshini Malla
Query: 2 / Answer: 2

19th Sep 2017 .

Create a PHP file which shows the following form with given design.

  

When a user click on REGISTER button, it validates the form. Such as

        v  All the fields are compulsory to fill up

        v  Name field shouldn’t be contain any number.

        v  Email id field contain email validation

        v  Mobile no field contain number  validation & exactly contain 10 numbers.

        v  By default  “Male” option should be selected.

        v  Only use Javascript Validations (Don’t use HTML & php validation)

After check proper validation, it moves to another page & display the form inputs like given  below

 

NB:

      v  This assignment should be completed in two  pages with proper designs.

      v  Can also use CSS as per required.

      v  Don’t use  database connection.


Answers

Biswajit Swain
Query: 1 / Answer: 42

19th Sep 2017 .

Two files require asg6.php & info.php

====================asg6.php==============================

<script>
function p()
{
var x=document.getElementById("a").value;
var y=document.getElementById("b").value;
var z=document.getElementById("c").value;
var p=document.getElementById("d").value;
var q=document.getElementById("e").value;
 
if((x=="")||(y=="")||(z=="")||(p=="")||(q==""))
{
document.getElementById('err').innerHTML="Plz fill up all the fields!!!";
return false;
}else{
document.getElementById('err').innerHTML="";
var n1=/^[A-Za-z]+$/;
  if(x.match(n1))
  {
document.getElementById('r').innerHTML="";
var n2=/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
  if(y.match(n2))
  {
document.getElementById('n').innerHTML="";
var n3=/^[0-9]+$/;
  if(z.match(n3)){
document.getElementById('m').innerHTML="";
if(z.length==10){
window.location="info.php?name="+x+"&email="+y+"&mob="+z+"&gen="+p+"&nat="+q;
}else{
document.getElementById('m').innerHTML="enter 10 digit Mobile no";
  document.getElementById('m').style.color="red";
return false;
}
 
 
}else{
 
document.getElementById('m').innerHTML="enter Valid Mobile no";
  document.getElementById('m').style.color="red";
return false;
}
  }else{
  document.getElementById('n').innerHTML="enter emaild@";
  document.getElementById('n').style.color="red";
return false;
}
  }else{
  document.getElementById('r').innerHTML="enter alfabet only";
  document.getElementById('r').style.color="red";
return false;
}
}
 
}
 
 </script>
<form name="form1" method="post">
  <table width="492" height="242" border="0">
    <tr>
      <td colspan="3" align="center"><span class="style1">STUDENT REGISTATION FORM </span></td>
    </tr>
    <tr>
      <td colspan="3" id="err" style="color:#FF0000; font-weight:bold;">&nbsp;</td>
    </tr>
    <tr>
      <td width="109">NAME:</td>
      <td width="157"><input type="text" name="n1" id="a"></td>
      <td width="150"><span id="r"></span></td>
    </tr>
    <tr>
      <td>EMAIL ID: </td>
      <td><input type="text" name="n2" id="b"></td>
      <td width="150"><span id="n"></span></td>
    </tr>
    <tr>
      <td>CONTACT:</td>
      <td><input type="text" name="n3" id="c"></td>
      <td width="150"><span id="m"></span></td>
    </tr>
    <tr>
      <td>GENDER:</td>
      <td><input name="n4" type="radio" value="male" id="d" checked="checked">
        MALE</td>
      <td><input name="n4" type="radio" value="female" id="d">
        FEMALE</td>
    </tr>
    <tr>
      <td>NATIONALITY:</td>
      <td><select name="n5" id="e">
 <OPTION>INDIA </OPTION>
 <OPTION>PAKISTAN </OPTION>
 <OPTION>SRILANKA </OPTION>
      </select>      </td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="button" name="n6" value="REGISTER" onclick="p();"></td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>
============================================================================
 
=================================info.php=====================================
 <center> 
   <h2>STUDENT REGISTATION FORM   </h2>
   <table width="316" height="200" border="0">
     <tr>
       <td>NAME:</td>
       <td><?php echo $_GET['name']; ?></td>
     </tr>
     <tr>
       <td>EMAIL ID: </td>
       <td><?php echo $_GET['email']; ?></td>
     </tr>
     <tr>
       <td>CONTACT:</td>
       <td><?php echo $_GET['mob']; ?></td>
     </tr>
     <tr>
       <td>GENDER:</td>
       <td><?php echo $_GET['gen']; ?></td>
     </tr>
     <tr>
       <td>NATIONALITY:</td>
       <td><?php echo $_GET['nat']; ?></td>
     </tr>
   </table>
   
 </center>
 
===========================================================================

 


  •  Information
  • About Forum

    This educational forum is produly developed by betaQsolutions-A leading software company in Odisha. This forum is developed to discuss the educational topics only betweeen the Students, teachers, Parents & Experts. Topic related to Career, Syllabus, Subjects, Questions, Exams etc are allowed to discuss here.

  • Statistics

    Total topics 43 • Total Query 1115 • Total members 247 • Total Answered 1286