i try different method to hide the "hide" div if status result is "E"
i have four status : R ,A , I and E,, if status is E then show the "hide" div other vise hide it,,
you people suggest me something, thanks in advance,,,

code is here :

<?php
 session_start();
?>
<html>
    <head>
        <title>Student Welcome</title>
         <script src="js/jquery-1.4.2.min.js" type="text/javascript"></script>
     <script language="javascript" type="text/javascript">
                      //   function load(){
                        //$('#hide').css('display','none');
                         //}
                            //var text = $('#show').text();
                            //var comparingText = 'R';
                            //$("#show").html('E')
                    //if(text==comparingText){
                        //$('#hide').css('display','block');

                    //};//else{
                        //  $('#hide').css('display','block');
                        //};
                        //launch code when dom is ready
//$(document).ready(){
  //if a div doesn't have content, then we should remove another div
  //if($('#show').html()!='E'){
    //$('#hide').hide()



     </script>
    </head>
    <body onload="load()"><pre> <?php echo $_SESSION['name'] ?> is login                                                       <a href="logout.php"><input type="button" name="Logout" value="Logout" style="width: 62px"/></a>  <a href="stdresetpass.php"><input type="button" name="resetpassord" value="Reset Password" style="width: 110px"/></a></pre>
        </br>
        </br>
        </br>
        <?php

  $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());
  }
   $RegNo = $_SESSION['registrationNo'];




   $qry   ="select registrationNo,name,fatherName,cnic,gender,discipline,department,admissionSession,email,password,address,domicile,contactNo,status,currentEmployer,designation,salaryInfo,totalExperience,lastOrganizationname,organizationAdd,organizationPhno,organizationEmail,Remarks from students where registrationNo='$RegNo' ";


  if (!mysql_query($qry,$con))
  {
  die('Error: ' . mysql_error());
  }
    $result= mysql_query($qry);
    $count =mysql_num_rows($result);
    if($count==1)
    {
    ?>

<?php
    while($row = mysql_fetch_array($result)){


    ?>
    <h3 align="center">Your Profile</h3>
    <table border="1" cellspacing="2" cellpadding="2" align="center">
<tr>
<td>Registration#</td>
<td><?php echo $row['registrationNo'] ?></td>
</tr>
<tr>
<td>Student Name </td>
<td><?php echo $row['name'] ?></td>
</tr>
<tr>
<td>Father's Name </td>
<td><?php echo $row['fatherName'] ?></td>
</tr>
<tr>
<td>CNIC#</td>
<td><?php echo $row['cnic'] ?></td>
</tr>
<tr>
<td>Gender</td>
<td><?php echo $row['gender'] ?></td>
</tr>
<tr>
<td>Discipline</td>
<td><?php echo $row['discipline'] ?></td>
</tr>
<tr>
<td>Department </td>
<td><?php echo $row['department'] ?></td>
</tr>
<tr>
<td>Admission Session</td>
<td><?php echo $row['admissionSession'] ?></td>
</tr>
<tr>
<td>Email Address </td>  
<td><?php echo $row['email'] ?></td>
</tr>
<tr>
<td>Address </td>
<td><?php echo $row['address'] ?></td>
</tr>
<tr>
<td>Domicile</td>
<td><?php echo $row['domicile'] ?></td>
</tr>
<tr>
<td>Contact# </td>
<td><?php echo $row['contactNo'] ?></td> 
</tr>
<tr>
<td>Status </td>
<td ><div id="show" ><?php echo $row['status'] ?></div></td>
</tr>
</table>
<div id="hide" >
<table>
<tr colspan="2"> 

<td align=center>Alumanai Record</td>

</tr>
<tr> 
<td>Current Employer</td>
<td><?php echo $row['currentEmployer'] ?></td>
</tr>
<tr>
<td>Designation </td>
<td><?php echo $row['designation'] ?></td>
</tr>
<tr>
<td>Salary Information </td>
<td><?php echo $row['salaryInfo'] ?></td>
</tr>
<tr>
<td>Total Experience </td>
<td><?php echo $row['totalExperience'] ?></td>
</tr>
<tr>
<td>
<td><?php echo $row['lastOrganizationname'] ?></td>
</tr>
<tr>
<td>Organization Address</td>
<td><?php echo $row['organizationAdd'] ?></td>
</tr>
<tr>
<td>Organization Phone#</td>
<td><?php echo $row['organizationPhno'] ?></td>
</tr>
<tr> 
<td>Organization Email</td>
<td><?php echo $row['organizationEmail'] ?></td>
</tr>
<tr>
<td>Remarks About Emplyer</td>
<td><?php echo $row['Remarks'] ?></td>
</tr>

</table>
</div>
   <?php
   }
   }




   mysql_close($con);
 ?>
    </body>  
</html>

Recommended Answers

All 3 Replies

You say the #hide div should be shown only if the status equals E. Are you referring to the status column returned by your query?

If so, could you not use this:

<?php if($row['status'] == 'E'): ?>
    <div id="hide">

        <!-- HTML table here -->

    </div>
<?php endif; ?>

Excellent. Please mark the thread as solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.