Hello, I'm creating a script where the user is asked for an Input where he can put a word or phrase and that decreases the number of characters.
pero me sale del todo bien
<?php
if(isset($_POST['enviar'])){
if(isset($_POST['texto'])){
$texto = trim($_POST['texto']);
$count = strlen($texto);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
</head>
<body>
<form method="post">
<input type="text" placeholder="Texto aqui" name="texto" id=""> <br>
<input type="submit" name="enviar" value="Enviar"><br>
</form>
<table>
<tr>
<th>Numero</th>
<th>Frase</th>
</tr>
<?php
for ($i=1; $i < $count; $i++) {
echo '<tr>
<td>'.$i.'</td>
<td>'.substr($texto,$i-1).'</td>
</tr>';
}
?>
</table>
</body>
</html>