kerz Posted March 10, 2007 Report Share Posted March 10, 2007 Kā panākt, lai teksta laukā varētu ierakstīt tikai 200 zīmes un tam visam klāt vēl malā rādītos atlikušais zīmju skaits? $name=mysql_real_escape_string($_POST['name']); $mail=mysql_real_escape_string($_POST['mail']); $comment=mysql_real_escape_string($_POST['comment']); $ip = $_SERVER['REMOTE_ADDR']; $mail = str_replace("<", "", $_POST['mail']); if(ereg("([[:alnum:]\.\-]+)(\@[[:alnum:]\.\-]+\.+)", $mail)) { $result = mysql_query("INSERT INTO news_coments (news_id, name, time, mail, comment, ip) VALUES ('$news_id','$name',CURDATE(),'$mail','$comment','$ip')",$connect); echo "<meta http-equiv=Refresh content=1;url=?action=news>"; echo "<div class='add_koments'>"; echo "Komentārs pievienots!<br>"; echo "</div>"; } Link to comment Share on other sites More sharing options...
andrisp Posted March 10, 2007 Report Share Posted March 10, 2007 1) Ko lai mēs daram ar to kodu, ko tu esi iepostējis ? 2) http://www.google.lv/search?hl=lv&q=ja...character+count Link to comment Share on other sites More sharing options...
kerz Posted March 10, 2007 Author Report Share Posted March 10, 2007 1) Ar to kodu ko lai darat nezinu, bet nezināju kā meklēt vajadzīgo info 2) Paldies par palīdzību, jo aši atradu to ko vēlējos. :) Link to comment Share on other sites More sharing options...
Stopp Posted March 10, 2007 Report Share Posted March 10, 2007 Tikai drošībai pārbaudi to zīmju garumu arī PHP galā (strlen funkcija, lai gan labāk mb_strlen, ja ir vajadzīgā ekstensija). Link to comment Share on other sites More sharing options...
andrisp Posted March 10, 2007 Report Share Posted March 10, 2007 mb_strlen, ja izmanto utf-8. Link to comment Share on other sites More sharing options...
Recommended Posts