witam mam taki problem mam formularz zrobiony i chcialbym zeby po kliknieciu wyslal on cala zawartosc do odpowiedniego diva
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('form').submit(function(e) {
e.preventDefault();
div = $(this).attr('action');
desc = $('textarea[name="tresc"]').val();
desc = $('input[name="zrodlo"]').val();
desc = $('input[name="image"]').val();
desc = $('input[name="login"]').val();
desc = $('input[name="temat"]').val();
$(div).html(desc)
});
});
</script>
<div id="contener"></div>
<?php
echo'
<form action="temat.php" method="POST">
<input type="url" name="zrodlo" class="wyg_input" autocomplete="off" required placeholder="Podaj link skąd wzięty został artykuł..."/>
<input type="url" name="image" class="wyg_input" autocomplete="off" required placeholder="Podaj link do zdjęcia..."/>
<input type="text" name="login" class="wyg_input" autocomplete="off" required placeholder="Podaj swój nick..."/>
<input type="text" name="temat" class="wyg_input" required autocomplete="off" placeholder="Podaj treść twojego tematu... "/>
<textarea name="tresc" class="wyg_text" rows="3" required autocomplete="off" placeholder="Treść twojej wiadomości..."></textarea>
<button type="submit" class="btn_wyslij" name="wyslij">Wyślij wiadomość</button>
</form>
</body>
</html>';
if(isset($_POST['wyslij']) && !empty($_POST['zrodlo']) && !empty($_POST['image']) && !empty($_POST['login']) && !empty($_POST['tresc']) && !empty($_POST['temat']))
{
$zrodlo = mysql_real_escape_string(htmlspecialchars($_POST['zrodlo']));
$image = mysql_real_escape_string(htmlspecialchars($_POST['image']));
$login = mysql_real_escape_string(htmlspecialchars($_POST['login']));
$tresc = mysql_real_escape_string(htmlspecialchars($_POST['tresc']));
$temat = mysql_real_escape_string(htmlspecialchars($_POST['temat']));
$data = date('Y-m-d H:i:s');
$ip = $_SERVER['REMOTE_ADDR'];
mysql_query ("INSERT INTO `tematy` (`zrodlo`, `image`,`login`, `data`, `ip`, `tresc`, `temat`) VALUES('$zrodlo' ,'$image', '$login', '$data', '$ip', '$tresc', '$temat')");
header('Location: '.$_SERVER['REQUEST_URI']);
}
else {
$query = mysql_query ("SELECT * FROM `tematy` ORDER BY `tematy`.`data` DESC");
echo '<div id="qt" >';
while($shout=mysql_fetch_array($query)) {
echo '<div id="st" ><div id="pt">';
echo"<a href='{$shout['zrodlo']}'</a>";
echo "<img src='{$shout['image']}'/>"
.'<b id="autor"> '.'Autor: '.$shout['login'].'</b> ' .'</br>'
.'<h1 id="temat">'.$shout['temat'].'</h1> ' .'</br>'
.'<p id="art_tre">'.$shout['tresc'].'</p>'.'</br>'
.'<br/>'
.'Czas Napisania: '.$shout['data'] .'</br>'
.'</div></div>';
}
echo '</div>';
}
?>
strona na ktorej to jest pokazane http://www.ocena.log.ugu.pl/ lecz to nie dziala moglby ktos to poprawic zeby to dzalalo