0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>Untitled Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
  <h2>Student Clearance Information</h2>

 <form action="students_clearance.php" method="post" name="form1">
  <table>
  <tr>
    <td> Department Id:</td>
    <td> <select id="Select1" name="department" >
    <option>Select Department</option>
        <option value="IIT">
           IIT
        </option>
         <option "IMS">
           IMS
        </option>
         <option "BSChe">
           BSChe
        </option>
         <option "BSPhy">
           BSPhy
        </option>
    </select> </td>
   </tr>

   <tr>
    <td> Registration No:</td>
    <td> <div id="regdiv"><select name="registration">
    <option value="">Select Registration</option>
    <?php
    $depart='department'.value;
    $con=mysql_connect("localhost:3307","root","kust");
if(!$con)
{
   die("Some problems occured during making connection with mysql".mysql_error());
}
?>
<?php
$bd_con= mysql_select_db("kustkht",$con);
if(!$bd_con)
{
   die("Some problems occured during selecting DataBase from MySQL".mysql_error());
}
?>
<?php $qry = mysql_query("select registrationNo from students where department='$depart' ORDER BY departmentName ASC"); while ($row = mysql_fetch_array($qry)) { ?>
<?php echo ("<option value = '" . $row['departmentName'] . "'>" . $row['departmentName'] . "</option>");?>
<?php }
?>
<?php
    mysql_close($con)
?>
</select>
</div></td>
   </tr>

    <td> Date:</td>
    <td> <input type="text" name=" Date" value="" /></td>
   </tr>
   <tr>
    <td> Clearance</td>
    <td> Yes <input type="radio" name="clearance" value="Yes"/> No <input type="radio" name="clearance" value="No"/></td>
    <td> &nbsp;</td>
   </tr>
   <tr>
    <td> Remarks About Clearance: </td>
    <td> <textarea name="RemarksClearance" rows="10" cols="50"></textarea>  </td>
   </tr>
   <tr>
    <td><br/> &nbsp &nbsp <input type="submit" value="Submit"/> </td>
   </tr>


  </table>
 </form>  
</body>
</html>

as mention department dropdown is client side,,, when selecting client side value from drop down it show me relavent record,,, and without button submit,,, so i dont know how to do it,,,,

2
Contributors
5
Replies
6
Views
4 Years
Discussion Span
Last Post by ainosilva
0

ainosilva as u told i try but failed in inserrting the registration no, three steps are there:
1st i select the department from studentClearance.php :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <title>Untitled Page</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script>
function getXMLHTTP() { //fuction to return the xml http object
        var xmlhttp=false;  
        try{
            xmlhttp=new XMLHttpRequest();
        }
        catch(e)    {       
            try{            
                xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp=false;
                }
            }
        }

        return xmlhttp;
    }



    function getReg(strURL) {       

        var req = getXMLHTTP();

        if (req) {

            req.onreadystatechange = function() {
                if (req.readyState == 4) {
                    // only if "OK"
                    if (req.status == 200) {                        
                        document.getElementById('regdiv').innerHTML=req.responseText;                       
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + req.statusText);
                    }
                }               
            }           
            req.open("GET", strURL, true);
            req.send(null);
        }

    }
    </script>
</head>
<body>
  <h2>Student Clearance Information</h2>

 <form action="students_clearance.php" method="post" name="form1">
  <table>
  <tr>
    <td> Department Id:</td>
    <td> <select id="Select1" name="department" onChange="getReg('findregno.php?department='+this.value)">
    <option>Select Department</option>
        <option value="IIT">
           IIT
        </option>
         <option "IMS">
           IMS
        </option>
         <option "BSChe">
           BSChe
        </option>
         <option "BSPhy">
           BSPhy
        </option>
    </select> </td>
   </tr>

   <tr>
    <td> Registration No:</td>
    <td> <div id="regdiv"><select name="registration">
    <option value="">Select Registration</option>
</select>
</div></td>
   </tr>

    <td> Date:</td>
    <td> <input type="text" name=" Date" value="" /></td>
   </tr>
   <tr>
    <td> Clearance</td>
    <td> Yes <input type="radio" name="clearance" value="Yes"/> No <input type="radio" name="clearance" value="No"/></td>
    <td> &nbsp;</td>
   </tr>
   <tr>
    <td> Remarks About Clearance: </td>
    <td> <textarea name="RemarksClearance" rows="10" cols="50"></textarea>  </td>
   </tr>
   <tr>
    <td><br/> &nbsp &nbsp <input type="submit" value="Submit"/> </td>
   </tr>


  </table>
 </form>  
</body>
</html>

2: step when i select department it populate the registration num from database throug findregno.php :

<?php
$depart=$_REQUEST['department'];
$con=mysql_connect("localhost:3307","root","kust");
if(!$con)
{
   die("Some problems occured during making connection with mysql".mysql_error());
}
?>
<?php
$bd_con= mysql_select_db("kustkht",$con);
if(!$bd_con)
{
   die("Some problems occured during selecting DataBase from MySQL".mysql_error());
}
?>
<select name="registration" >
<option value=-1>Select Registration#</option>
<?php $qry1 = mysql_query("select registrationNo from students where department = '$depart' "); while ($row = mysql_fetch_array($qry1)) { ?>
<?php echo ("<option value = '" . $row['registrationNo'] . "'>" . $row['registrationNo'] . "</option>");?>
<?php } 
?>
</select>
<?php
    mysql_close($con)
?>

when returnig the registration dropdown dynamic registation dropdown now visible, now on studentClearance page when i fill the form it takes the page to student_clearance.php:

 <?php //$regist=$_REQUEST['registration'];
  $con=mysql_connect("localhost:3307","root","kust");
  if(!$con)
  {
   die("Some problems occured during making connection with mysql".mysql_error());
  }
 ?>
 <?php
  $bd_con= mysql_select_db("kustkht",$con);
  if(!$bd_con)
  {
   die("Some problems occured during selecting DataBase from MySQL".mysql_error());
  }
 $clearance= $_POST['clearance'];
 $depart= $_POST['department'];

 $regist= $_POST['registration'];
 $qry="INSERT INTO studentsdepartments_clearance(departmentName,registrationNo,date,clearance,remarks) VALUES ('$depart',' $regist','$_POST[Date]','$clearance','$_POST[RemarksClearance]')";
 //echo $_POST['your_name'],$_POST['email_address'],$_POST['telephone'],$_POST['street_address'],$_POST['city'],$_POST['state_province'],$_POST['zipcode_postalcode'],$_POST['department_division'],$_POST['institution'],$_POST['web_site_of_institution'],$_POST['your_position'],$_POST['highest_degree'],$_POST['no_of_articles_published'],$_POST['no_of_book_chapters'],$_POST['no_of_books_published'],$_POST['editing_experience'],$_POST['areas_of_expertise'],$_POST['journal_wish_to_serve'],$_POST['cv'];
 if (!mysql_query($qry,$con))
  {
  die('Error: ' . mysql_error());
  }
  else
  {
   echo "Your form has been submitted !!!";
  }


   mysql_close($con)
 ?>

now the problem is on this page(student_clearance.php) because it does not take the registrationNo:

$regist= $_POST['registration'];

server takes the value of static dropdown(registration) on studentClearance.php and the visible drop down is dynamic(dropdown of findregno) , how i fix this problem,

0

ok, try to leave empty the regdiv first, because now you have to names registration, understand?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.