开发者

div coming down while refreshing the page

开发者 https://www.devze.com 2023-03-13 16:18 出处:网络
I want to make a page for android which is refreshing in every sec . All things are working well but the problem i am facing on this page when you click on the reserve button then entire div come down

I want to make a page for android which is refreshing in every sec . All things are working well but the problem i am facing on this page when you click on the reserve button then entire div come down and leave a small space above but after next refresh it becomes ok . I have tried without div but its not working Here is the code

<!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">
<?php
Header('Refresh:2;url=http://medical.gofreeserve.com/and/checkm.php');
?>
<head>

<style type="text/css">
<!--
.style2 {color: #FFFFFF}
-->
</style>
</head>

<body  bgcolor="#000000">

<?php 

include("../common/connection.php");

?>



<?php   


if(isset($_GET['reserve']))
{
 echo $sql = "UPDATE    newsevents SET booking ='1'  WHERE news_id='$_GET[val]'";
 $query = mysql_query($sql) or die(mysql_error());  
 }







$new_query=mysql_query("select * from newsevents where booking=0") or die(mysql_error());
while($row=mysql_fetch_array($new_query))
{
$id=$row['news_id'];
$date=$row['date'];
$news_text=$row['text'];



?> 



<div style="border-bottom:2px solid #FFFFFF" >
<form name="fm1" action="checkm.php"  method="get">
<table wi开发者_C百科dth="95%">



<tr>
<td width="60%" height="50" ><span class="style2"><?php echo $date ?></span></td>
<td width="40%"><span class="style2"><?php echo $news_text ?></span></td>
<td width="40%"><span class="style2"><input type="hidden" name="val" value="<?php echo $id?>" / ></span></td>
<td width="30%"><input type="submit"  name="reserve" id="reserve"  value="reserve"  /></td>

</tr>


</table>

</form>
</div>







<?php }?>



</body>
</html>


You're echoing the SQL statement when running the SQL query, which is pushing down the div. Just use the following instead:

if(isset($_GET['reserve']))
{
  $sql = "UPDATE newsevents SET booking ='1'  WHERE news_id='".$_GET['val']."'";
  $query = mysql_query($sql) or die(mysql_error());  
}
0

精彩评论

暂无评论...
验证码 换一张
取 消