I have a textbox that iterates 5 times and displays values from the textbox into an array.
<form method="post" action="test.php">
<?php for($i = 0; $i < 5; $i++) {
echo "<input type='text' name='text1[]'/>";
} ?>
<input type="submit" name="confirm" value="confirm" />
</form>
<?php
$text1 = $_POST['text1'];
$count= count($text1);
if(isset($_POST['confirm'])) {
for($p = 0; $p < $count; $p++) {
echo print_r($p[$i]);
}
}
?>
I want to remove the last value (which is that repeating number 1) from the data and only display the names. The output of above is as follows:-
John1
Jack1
Peter1
Jane1
Jill1