Storing form array data to Mysql using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
osemollie
Forum Newbie
Posts: 1
Joined: Thu Feb 02, 2006 2:23 am

Storing form array data to Mysql using php

Post by osemollie »

How can I Store form array data (eg checkboxes) to Mysql using php? And how can i display the results of these array information thereafter?

Thanks.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Post by jayshields »

Name your checkboxes checkbox[] and they will automatically be passed in an array to PHP.

Then you can do something like this to parse the results:

Code: Select all

foreach($_POST['checkbox'] as $key => $value) {
  //If you wanna show the results
  echo "$value<br />\n";

  //It's easy to do something with the results now you've got access to them, I can't demonstrate using MySQL with them because you're not specific enough
}
Post Reply