imarockstar Posted July 15, 2009 Share Posted July 15, 2009 I was wandering how to print out and echo this array .... what I have seems not to work ... my code <?php if ( $_POST['submit'] ) { $keys = array_values(array_keys($_POST)); $values = array_values($_POST); echo $values[$text1]; } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" ?> field 1 : <input name="mytext[text1]" size="20" > <br> field 2 : <input name="mytext[text2]" size="20" > <br> field 3 : <input name="mytext[text3]" size="20" > <br><br> <input type="submit" name="submit" value="test"> </form> Link to comment https://forums.phpfreaks.com/topic/166101-solved-array-help-part-1/ Share on other sites More sharing options...
rhodesa Posted July 15, 2009 Share Posted July 15, 2009 <?php if ( $_POST['submit'] ) { foreach($_POST['mytext'] as $key=>$value){ echo "$key: $value<br />"; } } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>" ?> field 1 : <input name="mytext[text1]" size="20" > <br> field 2 : <input name="mytext[text2]" size="20" > <br> field 3 : <input name="mytext[text3]" size="20" > <br><br> <input type="submit" name="submit" value="test"> </form> Link to comment https://forums.phpfreaks.com/topic/166101-solved-array-help-part-1/#findComment-875956 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.