rochellecanale Posted September 24, 2012 Share Posted September 24, 2012 hey guys just need a little help. All i want is to pass a multidimensional array values to a hidden form. And access the hidden form in my next page. How can i do that? Link to comment Share on other sites More sharing options...
rob Posted September 24, 2012 Share Posted September 24, 2012 You mean hidden form fields, right? You could put it in a session or send it via the $_POST array. How is the multidimensional array being created? Link to comment Share on other sites More sharing options...
HartleySan Posted September 24, 2012 Share Posted September 24, 2012 If you really want to, you can do something like the following: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Test</title> </head> <body> <?php if (isset($_POST['submit'])) { echo '<pre>'; print_r($_POST['data']); echo '</pre>'; } ?> <form action="" method="post"> <input type="hidden" name="data[]" value="0"> <input type="hidden" name="data[0][]" value="Cheese"> <input type="hidden" name="data[0][]" value="Bacon"> <input type="hidden" name="data[]" value="1"> <input type="hidden" name="data[1][]" value="Peppers"> <input type="hidden" name="data[1][]" value="Fork"> <input type="submit" name="submit" value="Submit"> </form> </body> </html> However, I'm having trouble coming up with a reason you'd want to do that. As rob said, storing that data in a session would probably be better. 3 Link to comment Share on other sites More sharing options...
Recommended Posts