Jump to content

Recommended Posts

Im using mysql and php to create the details for the checkboxes but i don't know what to do to get the selected ones. Also i would like to have two buttons on the form.

Im trying to create a list of people which will have access to a bank. The admin can change these and no one else. I want it so it changes the status of the people who she/he ticked on the checkboxes to/from allow and disallow.

[code]
echo "<a href=clan.php?action=changebank target=mainframe><u>Change Bank Access</u></a>";

if($action == changebank){

echo "<br><br>Select Members:<br>";

            $members1 = mysql_query("select * from `players` where `clan_name` = '$clan[name]'order by `clan_bank` asc");
                while($member = mysql_fetch_array($members1)) {


echo "<form>";

echo "<input type='checkbox' name='option$member[id]' > $member[display_name] ($member[clan_bank])<br>";

echo "<a href=clan.php?action=allow target=mainframe>Allow</a>";

echo "</form>";

}

if($action == allow){

if($option$member[id] == on){

mysql_query("UPDATE players set clan_bank=Yes where id='$member[id]'");

echo "You updated bank access";
}
}
}
}
[/code]


Please help


Thank You
Link to comment
https://forums.phpfreaks.com/topic/7324-php-form/
Share on other sites

Why are you opening and closing the form each time you display a checkbox? That's not going to work.

Also, to have 2 buttons that perform a specific submit operation, you're going to have to use JavaScript.

To answer the first question, if you have a field that is set to 0 or 1 depending on whether or not they're allowed, you just need to check for that condition when doing the echo of the record.

If you gave us a link or explained the problem a little better, we can help you more.
Link to comment
https://forums.phpfreaks.com/topic/7324-php-form/#findComment-26677
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.