celem jest pokazania na stronie komunikatu zwróconego przez skrypt php zamiast formularza - czyli podmiana zawartosci div-a o id = "wynik". Narazie niestety wszystkie komunikaty pojawiaja sie na czystej stronie zamiast w pliku .html
oto kod
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Language" content="pl"> <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-2"> <link rel="stylesheet" href="style.css" type="text/css"> <script type="text/javascript"> advAJAX.assign(document.getElementById("the_form"), { onSuccess : function(obj) { var element = document.getElementById("wynik"); element.innerHTML = obj.responseText; } }); </script> </head> <div id = "wynik"> <p class="para">Czekam na pytania, uwagi, sugestie dot. strony i Isengard.'; <form action="send.php" method="post" id ="the_form"> <table cellspacing="0" cellpadding="1" border="0" align="center" width="95%"> <tr> <td width="20%" valign="bottom" nowrap> </td> <td width="80%" align="left"> <input type="text" size="30" maxlength="50" name="temat" style="width:200px;"> </td> </tr> <tr> <td width="20%" valign="bottom" nowrap> </td> <td width="80%" align="left"> <input type="text" size="30" maxlength="50" name="email" style="width:200px;"> </td> </tr> <tr> <td width="20%" valign="bottom" nowrap class="underline"> </td> <td width="80%" align="left" class="underline"> </td> </tr> <tr> <td align="center" colspan="2"> </td> </tr> </table> </form> </div> </body> </html>
<?php #Pobieranie adresu IP $ip=$_SERVER['REMOTE_ADDR']; #Pobieranie serwera $host=gethostbyaddr($ip); #Pobieranie adresu strony $document=$_SERVER['HTTP_REFERER']; # temat $te = FALSE; $message .= 'Zapomniałeś podać temat wiadomości.'; $bg[1] = ' background-color: #C0C0C0; color: black'; } else { $te = $_POST['temat']; } $em = FALSE; $message .= 'Popraw swój adres e-mail.'; $bg[2] = ' background-color: #C0C0C0; color: black'; } else { $em = $_POST['email']; } # tresc $tr = FALSE; $message .= 'Zapomniałeś podać treść wiadomości.'; $bg[3] = ' background-color: #C0C0C0; color: black'; } else { $tr = $_POST['tresc']; } if ($te && $em && $tr) { $wiadomosc = " Wiadomość od $em: <br/><br/> $tr <br/><br/> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- <br/> IP nadawcy: $ip <br/> HOST nadawcy: $host <br/> wysłano z: $document <br/> "; $naglowki = "MIME-Version: 1.0rn"; $naglowki .= "Content-type: text/html; charset=iso-8859-2rn"; $naglowki .= "From: $emrn"; } else { } } ?>
a to link jak to obecnie działa: