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> Quote Link to comment 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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.