Witam, Chciałem spytać o następującą rzecz:
Mam stronę index.php, w niej jest div "zawartość" i tam jest ładowana zawartość plików *.inc (każda podstrona menu).
Problem w tym, że gdy ładuję plik kontakt.inc do tego div'a i klikam by wysłać wiadomość poprzez formularz kontaktowy, otwiera mi w tym divie stronę wyslane.inc ale jakby skrypt nie był wykonany.
Podejrzewam, że w "<form action="" " jest zwykłe otwarcie strony, może to jest przyczyną, ale nie wiem jak to ugryźć.
Poniżej zamieszczam kody źródłowe.
Plik Kontakt.inc:
<form action="javascript:ajaxpage('incl/wyslane.inc','tresc')" method="post">
<div class="formularz">
<table border=0>
<tr>
<td>
<label>
<input type="text" class="wpis" name="nazwa" id="Imię i Nazwisko" value="Imię i Nazwisko" onFocus="if(this.value == 'Imię i Nazwisko') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Imię i Nazwisko';}" maxlength="50" />
</label>
</td>
<td rowspan="4">
<label>
<textarea class="wiadomosc" name="wiadomosc" id="wiadomosc" value="Zadaj nam pytanie..." onFocus="if(this.value == 'Zadaj nam pytanie...') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Zadaj nam pytanie...';}" style="overflow:auto, hidden"></textarea>
</label>
</td>
</tr>
<tr>
<td>
<label>
<input type="text" class="wpis" name="temat" id="Temat" value="Temat" onFocus="if(this.value == 'Temat') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Temat';}" maxlength="30"/>
</label>
</td>
</tr>
<tr>
<td>
<label>
<input type="text" class="wpis" name="mail" id="Mail" value="Adres e-mail" onFocus="if(this.value == 'Adres e-mail') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Adres e-mail';}" maxlength="40"/>
</label>
</td>
</tr>
<tr>
<td>
<label>
<input type="text" class="wpis" name="telefon" id="Telefon" value="Telefon kontaktowy" onFocus="if(this.value == 'Telefon kontaktowy') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Telefon kontaktowy';}" maxlength="12"/>
</label>
</td>
</tr>
</table>
<center>
<input type="submit" class="button" value="Wyślij"/>
<input type="reset" class="button" value="Wyczyść"/>
</center>
</div>
</form>
A tutaj plik wyslane.inc
<?php
$nazwa = $_POST['nazwa'];
$temat = $_POST['temat'];
$mail = $_POST['mail'];
$telefon = $_POST['telefon'];
$wiadomosc = $_POST['wiadomosc'];
if ($nazwa =! '' && $temat =! '' && $mail =! '' && $wiadomosc =! '')
{
$to = '[email protected]';
$subject = $_POST['temat'];
$message = $_POST['wiadomosc'];
$headers = 'From: ' .$_POST['mail']. "\r\n" .
'Imie i nazwisko: ' .$_POST['nazwa']. "\r\n" .
'Adres E-mail: ' .$_POST['mail']. "\r\n" .
'Telefon: ' .$_POST['telefon'];
mail($to, $subject, $message, $headers);
echo 'Mail wyslany pomyslnie';
}
else
{
echo 'Podaj Imie, nazwisko, temat, mail oraz wiadomosc';
}
?>
Z góry dziękuję za pomoc,
Pozdrawiam,
Patryk.