Разработка web-узла системы бронирования номеров в отелях, страница 4

                              }

                    }

                    $result = mysql_query("SELECT * FROM guest_book");

                    if(mysql_num_rows($result) > 0)

                    {

                              while($row = mysql_fetch_array($result))

                              {

                                         //$row["login"] =  iconv ("UTF-8", "Windows-1251", $row["login"]);

                                         //$row["post"] = iconv ("UTF-8", "Windows-1251", $row["post"]);

                                         echo '<div id="post_'.$row["id"].'" class="post">';

                                         echo '<b>'. $row["login"]. ' написал:</b><br>';

                                         echo $row["post"];

                                         echo '<hr>';

                                         echo '</div>';

                              }

                    }

                    else

                    {

                              echo '<hr>';

                    }

          }

          $name = isset($_SESSION["login"]) ? $_SESSION["login"] : "Гость";

?>

func.js

var xmlhttp;

function GetXmlHttp()

{

          if (window.XMLHttpRequest)

          {

                    return new XMLHttpRequest();

          }

          if (window.ActiveXObject)

          {

                    return new ActiveXObject("Microsoft.XMLHTTP");

          }

          return null;

}

function add_cart(id)

{

          xmlhttp=GetXmlHttp();

    if (xmlhttp==null)

    {

        alert ("Browser does not support HTTP Request");

        return;

    }

    var url="add_cart.php?id="+id;

          xmlhttp.onreadystatechange=function()

          {       

                    if(xmlhttp.readyState==4)

                    {       

                              var e = document.getElementById("good"+id)

                              e.innerHTML = xmlhttp.responseText;                  

                    }

          }

    xmlhttp.open("GET",url,false);

    xmlhttp.send(null);

function removeFromCart(id)

{

          xmlhttp=GetXmlHttp();

    if (xmlhttp==null)

    {

        alert ("Browser does not support HTTP Request");

        return;

    }

    var url="del_cart.php?id="+id;

                    xmlhttp.onreadystatechange=function()

          {       

                    if(xmlhttp.readyState==4)

                    {        //alert(xmlhttp.responseText);

                              var e = document.getElementById("view_room"+id)

                              e.innerHTML = xmlhttp.responseText;        

                              count = parseInt(document.getElementById("cnt").innerHTML);

                              //alert(count)

                              if(count > 0) count--;

                              document.getElementById("cnt").innerHTML = (count+'');

                    }

          }

    xmlhttp.open("GET",url,false);

    xmlhttp.send(null);

}

function restore(id)

{

          xmlhttp=GetXmlHttp();

    if (xmlhttp==null)

    {

        alert ("Browser does not support HTTP Request");

        return;

    }

    var url="restore.php?id="+id;