harlequeen Posted July 25, 2009 Share Posted July 25, 2009 Hi I am trying to pass a set of points for a selection of teams from a form which I have. In the form I have each qualifying team with a select statement allowing me to choose between 0 & 7 points. How do i then get the information into my points section for each team in my table? I have the array of teams printed with the dropdown with the points available and the teams id number, but I don't know how to get the points into the correct teams' section in the database. Can anyone help please. I have tried to look at some tutorials but I can only really find ones on checkboxes and they don't seem to help me. I'm not great at php/mysql as I'm trying to teach myself. If someone can point me in the right direction for a turorial that would be a great help (the simpler, the better). thanks in advance. Link to comment https://forums.phpfreaks.com/topic/167400-passing-an-array-of-data-from-a-form/ Share on other sites More sharing options...
.josh Posted July 25, 2009 Share Posted July 25, 2009 http://www.phpfreaks.com/tutorial/php-basic-database-handling Link to comment https://forums.phpfreaks.com/topic/167400-passing-an-array-of-data-from-a-form/#findComment-882735 Share on other sites More sharing options...
Psycho Posted July 25, 2009 Share Posted July 25, 2009 I think what you want to do is give the select statements a name such that they will be returned as an array with the team ID as the index. Here is what the HTML output would look like: Team 1 <select name="team_points[1]"> When you create these in PHP I would assume you are looping through the teams and writing the data. The PHP code would look something like this: echo "$teamName <select name="team_points[$teamID]">"; In the processing page you can simply loop through the POST array value to get the team IDs and Points submitted foreach ($_POST['team_points'] as $teamID => $teamPoints) { echo "Team ID: $teamID, Team Points: $teamPoints <br> "; } Link to comment https://forums.phpfreaks.com/topic/167400-passing-an-array-of-data-from-a-form/#findComment-882803 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.