0

Div popup appears and then disappears automatically in a second or less. Whats the problem?

<html> <head> <style> #popUp{ position: fixed; z-index:200; width:100%; height:100; top:0; background-color:rgba(0,0,0,.8); color:white; text-align:center; font-family:helvetica; padding:2px; bottom:0; left:0; right:0; visibility:hidden; } #crossExit{ margin-right:10px; float:right; margin-top:10px; background-color:white; border:2px solid white; border-radius:2px; vertical-align:middle; text-align:center; } </style> </head> <body> <?php include "connection.php"; $sql = "select * from moviedetails"; $executionOfSQL=mysqli_query($connect,$sql); while($product = mysqli_fetch_assoc($executionOfSQL)){?> <h1> <?php echo $product["MovieName"] ?> </h1> <form method="POST" action="index.php"> <input type="hidden" name="MovieID" value="<?php echo $product["MovieID"] ?>" > <input onclick="exitPopUp()" type="submit" name="submit" > </form> <?php } ?> <!-- This is the div that covers the whole page when a user visits the home page--> <div id="popUp"> <img onclick ="exitPopUp()" id="crossExit" src="" height="20" width="20"> <?php if ( isset( $_POST['submit'] ) ) { $MovieID =$_POST["MovieID"]; $sql1 = "select * from moviedetails where MovieID ='$MovieID'"; $executionOfSQL1=mysqli_query($connect,$sql1); ?> <?php while($product = mysqli_fetch_assoc($executionOfSQL1)){ ?> <h1> <?php echo $product['MovieID']; ?> </h1> <h1> <?php echo $product['MovieName']; ?> </h1> <h1> <?php echo $product['MovieDescription']; ?> </h1> <?php } } ?> </div> <script> var popUp=document.getElementById("popUp"); function exitPopUp(){ if(popUp.style.visibility=="visibile"){ popUp.style.visibility="hidden"; }else popUp.style.visibility="visible"; } </script> </body> </html>

28th Sep 2018, 2:17 PM
Mogammad Shameer Losper
Mogammad Shameer Losper - avatar
1 ответ
+ 1
Its okay, i solved it . Changed input submit to button and it works
28th Sep 2018, 2:39 PM
Mogammad Shameer Losper
Mogammad Shameer Losper - avatar