removing last element from a multidimensional array in php -
i have textbox iterates 5 times , displays values textbox 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 remove last value (which repeating number 1) data , display names. output of above follows:-
john1 jack1 peter1 jane1 jill1
echo print_r($p[$i]); print_r prints content of $p[$i] , returns 1 passed echo (and printed next desired output). don't need print_r here.
Comments
Post a Comment