I have looked at a tut on here to build a full featured login system. I need that, and have completed that tut. But I wanted to add the ability to have a form for when a user is logged in that it has the current logged in user filled in the form by default. And all they have to do is click signup and then it adds the username into a new table.
So I have the part figured out on showing the current logged in user in the form. But I have been doing research on the best way to have the second step, which is the part upon clicking signup to be added to a new table.
What I’m trying to do is have a weekly signup form so I can tell how many and which users are going to attend an event. Am I even going about it the correct way by creating a new table? Or should it just be a new row in the first table created in my DB?
I have 12 events I will be having almost 12 weeks in a row. And after then event I will be entering some values per username that signed up. For at the end of the 12 events to be a tally.
From what I have researched, it seems I need to use the SQL insert into function. But I am having problems getting this accomplished.
Would some of you php experts please lead me in the correct direction. I have been searching online for 5 days. Cant seem to get any example to translate for me and be able to apply it to my project.
Here is a pastebin of the first part of the functionality I have working for the signup page – http://pastebin.com/NeUG2×4b you’ll notice I do not have the it completed. And there is stuff that will be removed from that code. I am trying to tear apart the other form and insert the new lines of code that I need. I am new to php and writing things completely from scratch is difficult!
- Author had a File in an Envato Bundle
- Author had a Free File of the Month
- Author was Featured
- Bought between 10 and 49 items
- Has been a member for 4-5 years
- Item was Featured
- Referred between 10 and 49 users
- Exclusive Author
- Sold between 50 000 and 100 000 dollars
mxpimp47, there can be multiple ways to do what you’re after, so I’m just going to suggest a simple one (not the most optimized one).
I’m assuming that in your project you have a table of users and that your login system and session id can identify the currently logged in user.
1. You should create a table for events (events) to store the events you want people to sign up to (event A, event B … event X)
2. Another table (attendees) that holds those data for people who signed up to different events
3. For every person who signs up to ‘event A’ you need to create a new record in the attendees table which references event A record from the events table and also has the detail of the person and when to attend (i.e. events A, Jason Smith, Date of event, ... )
4. Since you’re session id can identify who is logged in, then you really don’t need people to type in their name every time they sign up (unless you have your own reasons for). Therefore you can just have a radio button under each event to let the user choose the event he wants to attend and then press submit.
5. Then your code needs to read which event was selected, identify the member and then create a new record in the attendees table.
This is a very rough description of what needs to be done. Other people here may achieve this different to what I’m suggesting. It just goes to show that there are many ways of doing the same thing. Don’t be too concerned about how you do it and concentrate of learning as much as you can.
Thanks for your reply! Im confused on if I use the ID of the user registered and they are logged in, how do I know what person that is in the events table? Is there a way to pull all the data (or only specific fields) for the id in a table and put it in another (event A) for example?
What I did was create a variable for the session id and store the username logged in into a hidden form field in the signup form. Then they dont have to do anything but click signup. I just echoed their username so they know they see their username by the signup button. But I still havent figured out how to display a message that shows they have entered the event. And to not allow them to signup again, until the next event is open for signup!
Whats the best way about having multiple event signup’s created and to have them show by a date/time so users can signup? So I can create them ahead of time, and they would just dynamically appear. That way I dont have to touch any code.
Im new to php and working with Mysql database’s. But Im getting things figured out slowly but surely. Some things that may be obvious, arent so obvious to me from the lack of knowledge. I just have to do some searching for answers, and if I cant find one I try to post on here!
Thanks again for your help.
