patsman77 Posted November 12, 2006 Share Posted November 12, 2006 Hello, I am new to working with databases, but have a question that am hoping for an answer. I want to know if I can submit a "form" into a database table, or do I have to set up fields for each item within the form? I run a football pool, where the pool members go to my site, pick the teams from the games listed, then submit them to me via email. What I am looking for is for them to submit the picks, then when they go back to the sheet to pick the games, their picks are still there...meaning the form has been saved in database wunder their user id. Is posting it to the database as a form possible, or does it have to be by individual fields? Any information would be great. Thanx,Patsman77 Link to comment https://forums.phpfreaks.com/topic/26979-submitting-form-into-mysql/ Share on other sites More sharing options...
bqallover Posted November 12, 2006 Share Posted November 12, 2006 Well, you'd send the form to a script, which would then process it and add rows to a database table. Could you post a link to your site so we could see what kind of data you are dealing with? However, I'd probably have a 'picks' table with entry_id, user_id, team_id, and a datetime or weeknumber. And also a 'teams' table with team_id and name fields. A row would be added to the 'picks' table for each team the user chooses. You could then repopulate a form or just display the picks based on a query on user and datetime/weeknumber.I'm not overly familiar with football pools, but I reckon it would work something like that. :) Link to comment https://forums.phpfreaks.com/topic/26979-submitting-form-into-mysql/#findComment-123402 Share on other sites More sharing options...
patsman77 Posted November 25, 2006 Author Share Posted November 25, 2006 Hello and thanx for replying to my message. I finally got to the point where my site is user authenticated, and am now ready to tackle the issue of my post. Here is a sample of the form that I am looking to store in mysql.[url=http://swammisports.com/piksheet2.htm]http://swammisports.com/piksheet2.htm[/url]Any info you can supply wouldbe greatly appreciated. At this point I plan on adding user authenticate lines at the top and saving as a php file. Thanx in advance, and if any more info is needed, let me know and I will reply ASAP!Patsman77 Link to comment https://forums.phpfreaks.com/topic/26979-submitting-form-into-mysql/#findComment-130277 Share on other sites More sharing options...
Barand Posted November 26, 2006 Share Posted November 26, 2006 I'd add a checkbox to each line which the user can tick to select the match. Make the checkbox name something like "game[]" and give each checkbox a value equal to the id of the game.echo "<input type='checkbox' name='game[]' value='$gameid'>";When the form is submitted,[code]foreach ($_POST['game'] as $gameid) { // store selected game id in DB for the user}[/code] Link to comment https://forums.phpfreaks.com/topic/26979-submitting-form-into-mysql/#findComment-130283 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.