HTML Question

how to hide the button after click

applicant_exam.php

<?php


$sql="SELECT jc.catergory_name,jc.catergory_id,j.role,j.job_id,ex.exam_paper_name,ex.exam_paper_id,ex.dateposted,ex.deadline FROM applicant a LEFT JOIN applicant_apply_job aaj ON a.email=aaj.email LEFT JOIN job j ON aaj.job_id=j.job_id LEFT JOIN job_catergory jc ON j.catergory_id=jc.catergory_id LEFT JOIN exam_paper ex ON j.job_id=ex.job_id WHERE ex.status='1' AND a.email='koshila827@gmail.com'";

$result = mysqli_query($dbcon, $sql);
?>


<table>
<caption>Available Exams</caption>
<thead>
<th>Category Name</th>
<th>Role</th>
<th>Exam Paper Name</th>
<th>Dareposted</th>
<th>Closing Date</th>
<th>Action</th>

</tr>
</thead>


<?php
while($row = mysqli_fetch_array($result)){
?>
<tr>
<td><?php echo $row["catergory_name"]; ?></td>
<td> <?php echo $row["role"]; ?></td>
<td><?php echo $row["exam_paper_name"]; ?></td>
<td> <?php echo $row["dateposted"]; ?></td>
<td><?php echo $row["deadline"]; ?></td>
<td>



<a href="start_exam_paper.php?exid=<?php echo $row['exam_paper_id'];?>&catid=<?php echo $row['catergory_id'];?>&jobid=<?php echo $row['job_id'];?>">
<button id="start" class="delBtn"><i class="fa fa-arrow-circle-right"></i>&nbsp;Start Exam</button>




</a>
</td>
</tr>
<?php

} ?>
</table>


After click the "Start Exam " button in applicant_exam.php it reload to the "start_exam.php"
How to hide the "Start Button after click".
When the user can click the back button in web browser the button want to hide

Answer Source

You can achieve this by using sessions in php.

In the applicant_exam.php add this

<?php
   //start session
   if (session_status() == PHP_SESSION_NONE) {
    session_start();
    $_SESSION["Visibility"] = "visible";
 }

$sql="SELECT jc.catergory_name,jc.catergory_id,j.role,j.job_id,ex.exam_paper_name,ex.exam_paper_id,ex.dateposted,ex.deadline FROM applicant a LEFT JOIN applicant_apply_job aaj ON a.email=aaj.email LEFT JOIN job j ON aaj.job_id=j.job_id LEFT JOIN job_catergory jc ON j.catergory_id=jc.catergory_id LEFT JOIN exam_paper ex ON j.job_id=ex.job_id WHERE ex.status='1' AND a.email='koshila827@gmail.com'";

$result = mysqli_query($dbcon, $sql);
?>

Now in the anchor,

<a href="start_exam_paper.php?exid=<?php echo $row['exam_paper_id'];?>&catid=<?php echo $row['catergory_id'];?>&jobid=<?php echo $row['job_id'];?>" 
            //this will set the visibility
 style="visibility:<?php echo $_SESSION["Visibility"]; ?>">
 <button id="start" class="delBtn"><i class="fa fa-arrow-circle-right"></i>&nbsp;Start Exam</button> 
</a>

Now in the start_exam.php do this in the top,

<?php 
 $_SESSION["Visibility"] = "hidden";
?>

Thus when the user comes back to the applicant_exam.php, the visibility will be hidden, hence it wont show up.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download