MC_delta_T adlı üyeden alıntı:
mesajı görüntüle
Kodda hata var. Test edip koyacağım tekrardan.
16
●1.134
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Temizle</title>
</head>
<?
$page = $_GET["page"];
if($page == "")
{
?>
<body>
<form id="form1" name="form1" method="post" action="?page=temizle">
<textarea name="textarea" id="textarea" cols="50" rows="10"></textarea>
<input type="submit" name="button" id="button" value="Submit" />
</form>
<? }
elseif($page == "temizle")
{
echo $_POST["textarea"]."<br>";
echo TRCharEscape($_POST["textarea"],'<B>','</B>');
}
function TRCharEscape($str,$tagopen,$tagclose) {
$search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü');
$replace = array($tagopen.'C'.$tagclose,$tagopen.'c'.$tagclose,$tagopen.'G'.$tagclose,$tagopen.'g'.$tagclose,$tagopen.'i'.$tagclose,$tagopen.'I'.$tagclose,$tagopen.'O'.$tagclose,$tagopen.'o'.$tagclose,$tagopen.'S'.$tagclose,$tagopen.'s'.$tagclose,$tagopen.'U'.$tagclose,$tagopen.'u'.$tagclose);
$new_text = str_replace($search,$replace,$str);
echo $new_text;
}
?>
</body>
</html>Buyur çalışıyor. Burada echo TRCharEscape($_POST["textarea"],'<B>','</B>'); <b> </b> kalın yapmaya yarıyor. İtalik yapmasını istiyorsan eğer <B> </B> yerine <I> </I> yazman yeterlidir. hem kalın hem italik için ise '<b><I>','</I></B> yazman yeterlidir.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Temizle</title>
</head>
<?
$page = $_GET["page"];
if($page == "")
{
?>
<body>
<form id="form1" name="form1" method="post" action="?page=temizle">
<p>
<textarea name="textarea" id="textarea" cols="50" rows="10"></textarea>
</p>
<p>
<input type="text" name="textfield" id="textfield" />
<input type="text" name="textfield2" id="textfield2" />
<input type="text" name="textfield3" id="textfield3" />
<input type="text" name="textfield4" id="textfield4" />
<input type="text" name="textfield5" id="textfield5" />
</p>
<p>
<input type="submit" name="button" id="button" value="Submit" />
</p>
</form>
<? }
elseif($page == "temizle")
{
foreach ($_POST as $k=>$v)
{
if(is_array($v))
{
while (list ($key, $val) = each ($v))
{
$val = strip_tags($val);
$val = TRCharEscape($val);
$_POST[$k][$key] = $val;
}
}
else
{
$val = strip_tags($v);
$val = TRCharEscape($v);
$_POST[$k] = $val;
}
}
echo $_POST["textarea"].'<br>';
echo 'textfield1 : ' .$_POST["textfield"].'<br>';
echo 'textfield2 : ' .$_POST["textfield2"].'<br>';
echo 'textfield3 : ' .$_POST["textfield3"].'<br>';
echo 'textfield4 : ' .$_POST["textfield4"].'<br>';
echo 'textfield5 : ' .$_POST["textfield5"].'<br>';
}
function TRCharEscape($str)
{
$e_char = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü');
$r_char = array('<I>C</I>','<I>c</I>','<I>G</I>','<I>g</I>','<I>i</I>','<I>I</I>','<I>O</I>','<I>o</I>','<I>S</I>','<I>s</I>','<I>U</I>','<I>u</I>');
return str_replace($e_char, $r_char, $str);
}
?>
</body>
</html>dorime verdiğim kodda hem senin yolladığın değer yazıyor altında da değişikmiş olanı yazıyor.echo $_POST["textarea"]."<br>"; bu satırı silersen eğer senin yolladığın yazılmaz. Hata yok yani.