Autor | Zpráva | ||
---|---|---|---|
tazzys Profil |
Nějak sem nepochopil jak to mám udělat.
ve scriptu po kliknutí na smalík se vloží do textarea <script> function pridejSmajlik(smilie){ document.book.comment.focus(); document.book.comment.value += smilie + " "; document.book.comment.focus(); } </script> <a href="javascript:pridejSmajlik(':-D')"><img src="images/smajlici/smiley_icq1.gif" border="0"></a> <a href="javascript:pridejSmajlik(':-P')"><img src="images/smajlici/smiley_icq2.gif" border="0"></a> <a href="javascript:pridejSmajlik(':-(')"><img src="images/smajlici/smiley_icq3.gif" border="0"></a> poté bych potřeboval, pokud bude v textarea tento smalík, aby se při zadávání do DB změnilo na: <img src="images/smajlici/smiley_icq1.gif" width="20" height="20" alt=":-D"> <?php $comment=str_replace(":-D",'<img src="images/smajlici/smiley_icq1.gif" width="20" height="20" alt=":-D">',$comment); $comment=str_replace(":-P",'<img src="images/smajlici/smiley_icq2.gif" width="20" height="20" alt=":-P">',$comment); $comment=str_replace(":-(",'<img src="images/smajlici/smiley_icq3.gif" width="20" height="20" alt=":-(">',$comment); ?> <?php session_start(); ?> <?php Session_start(); require_once "config.php"; if($_GET['id'] != ""){ $idecko = $_GET['id']; }else{ $idecko = 1; } if($_POST['odoslane1'] == "ano"){ $chyba = true; if($_SESSION["captcha"] == $_POST["captcha"]){ if($_POST['name'] != ""){ if($_POST['comment'] != ""){ $komentar = htmlspecialchars($_POST['comment']); $meno = htmlspecialchars($_POST['name']); mysql_query("INSERT INTO diskuze (id, meno, mail, text, cas) VALUES (0, '".$meno."', '".$_POST['email']."', '".$komentar."', ".time().")"); $chyby = "<div class=\"correctdiv\">Komentár byl úspesne odeslán</div>"; $chyba = false; }else{$chyby = "<div class=\"errordiv\">Nevyplnili ste text komentara</div>";} }else{$chyby = "<div class=\"errordiv\">Nevyplnili ste meno</div>";} }else{$chyby = "<div class=\"errordiv\">Zadali ste nespravny captcha kod</div>";} } ?> <script> function pridejSmajlik(smilie){ document.book.comment.focus(); document.book.comment.value += smilie + " "; document.book.comment.focus(); } </script> <h2 class="subtitle">Napsat komentář</h2> <form method="post" id="frmcomment"> <input type="hidden" name="odoslane1" value="ano" /> <div> <label for="lblname">Jméno <span>(povinné)</span></label> <input type="text" name="name" <?php if($chyba){ if($_POST['name'] != ""){ echo 'value="'.$_POST['name'].'" '; }} ?>class="textboxcomment" id="lblname" /><br /> <label for="lblemail">Email <span>(nepovinné)</span></label> <input type="text" name="email" <?php if($chyba){ if($_POST['email'] != ""){ echo 'value="'.$_POST['email'].'" '; }} ?>class="textboxcomment" id="lblemail" /><br /> <label for="lblcomment">Text <span>(povinné)</span></label> <a href="javascript:pridejSmajlik(':-D')"><img src="images/smajlici/smiley_icq1.gif" border="0"></a> <a href="javascript:pridejSmajlik(':-P')"><img src="images/smajlici/smiley_icq2.gif" border="0"></a> <a href="javascript:pridejSmajlik(':-(')"><img src="images/smajlici/smiley_icq3.gif" border="0"></a> <textarea name="comment" cols="80" rows="10" id="lblcomment" class="textareacomment"> <?php if($chyba){ if($_POST['comment'] != ""){ echo $_POST['comment']; }} ?></textarea><br /> <label for="lblcaptcha"><img src="captcha.php" alt="captcha" /> Opsat kód do políčka níže <span>(povinné)</span></label> <input type="text" name="captcha" class="textboxcomment" id="lblcaptcha"/><br /> <input type="submit" name="submitcomment" class="submitcomment" value="Odeslat" /> </div> </form> vyřešeno, moje chyba |
||
Časová prodleva: 9 let
|
0