waynew Posted September 15, 2008 Share Posted September 15, 2008 Hey guys, I need some advice... I'm building a social network of the sorts and I'm allowing users to add each other as friends. One user sends a friend invitation and the other user who recieves it accepts it or denies it. Each user will have a friends request page, which will show all of his or her friend invites. Each friend request is has a friendship_id (Primary key). Now, I have no idea how many friend requests a person will be getting and what these friendship_id's will be. I'm wanting to have it so that the awaiting invitations page has a radio button which has an accept or deny under each of the users pictures who are sending a friend request. Then after the user has picked the radio option he or she has chosen, all he or she has to is press one button and all picked actions are attributed to each request. How could I deal with this dynamic form? Quote Link to comment https://forums.phpfreaks.com/topic/124377-dynamic-form/ Share on other sites More sharing options...
.josh Posted September 15, 2008 Share Posted September 15, 2008 I think by radio button you mean checkbox for making multiple selections? in your form element you would do for example: <input type = 'checkbox' name = 'friendship_id[]'>Andy <input type = 'checkbox' name = 'friendship_id[]'>Beth <input type = 'checkbox' name = 'friendship_id[]'>Sue and then in your processing script, you would access it like a 2d array. Assuming you checked all 3, an example of use would be: echo $_POST['friendship_id'][0]; // echo Andy echo $_POST['friendship_id'][1]; // echo Beth echo $_POST['friendship_id'][2]; // echo Sue Quote Link to comment https://forums.phpfreaks.com/topic/124377-dynamic-form/#findComment-642352 Share on other sites More sharing options...
waynew Posted September 15, 2008 Author Share Posted September 15, 2008 Thanks! I think I'll go for checkboxes instead. It's just that another site were using radio buttons. Quote Link to comment https://forums.phpfreaks.com/topic/124377-dynamic-form/#findComment-642358 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.