Jump to content

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/124377-dynamic-form/
Share on other sites

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

 

Link to comment
https://forums.phpfreaks.com/topic/124377-dynamic-form/#findComment-642352
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.