PHP Girilen Metni Karakter Karakter Ekrana Yazdırma

sdkbyrm

webmasterfrm
Üyelik Tarihi
23 Aralık 2020
Mesajlar
813
Beğeniler
1
Ticaret: 0 / 0 / 0
Bu örneğimizde kullanıcının klavyeden girmiş olduğu bir metni baştan başlayarak merdiven şeklinde yazdıran php kodlarını yazacağız.


Bunun için bir tane metni girmemizi sağlayan form sayfası bir tane de merdiven şeklinde yazdıran işlem sayfası olması gerekiyor.

Bu sayfaların kodları aşağıda gösterilmiştir. Ayrıca sayfanın altında bir tane uygulamayı test etme linki bulunmaktadır.

merdiven1.php dosyası kodları:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

<!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>PHP Merdivenli Yazdırma-1</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>

<form action="merdiven2.php" method="post">
<table border="0" bgcolor="#006699" >
<tr bgcolor="#00FF99">
<td colspan="2" align="center">PHP Girilen İfadeyi Merdivenli Yazdırma</td>
</tr>
<tr>
<td>Metni Giriniz:</td>
<td><input name="metin" type="text" /></td>
</tr>

<tr bgcolor="#00FF99">
<td>&nbsp;</td>
<td><input name="gonder" type="submit" value="Merdivenli Yazdır" /></td>
</tr>
</table>

</form>
<br />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- BannerKucuk -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-2151654795043080"
data-ad-slot="8393636475"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</body>
</html>
merdiven2.php dosyası kodları:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

<!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>PHP Merdivenli Yazdırma-2</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

<body>
<?php
$metin=$_POST['metin'];


$uzunluk= strlen($metin);

?>

<table width="435" border="1" bgcolor="#FFFF66">
<tr bgcolor="#00CCCC">
<td colspan="2" align="center">PHP Rastgele Sayı Üretme</td>
</tr>
<tr bgcolor="#99FF66">
<td width="206">Girilen Metin:</td>
<td width="213"><?php echo $metin; ?></td>
</tr>
<tr bgcolor="#CC9966">
<td colspan="2">
<?php
for ($i=0;$i<=$uzunluk;$i++)
{
$yaz=substr($metin, 0, $i );
echo $yaz . "<br>";
}

?>




</td>
</tr>
</table>
<A HREF="javascript:javascript:history.go(-1)">Geri dön</A>
<br />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- BannerKucuk -->
<ins class="adsbygoogle"
style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-2151654795043080"
data-ad-slot="8393636475"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</body>
</html>
Ekran Görüntüleri:
1608738808619.png
1608738819841.png
 
Üst