![]() |
Add Checkboxes to Form
I am trying to add checkboxes to the free agent signup form in the vbTournaments mod. I have created the extra field in the database table and a single selection works without issue. The problem I have is that when multiple checkboxes are selected only the last selection is saved to the database instead of all of the choices.
tmnt_newfreeagent template: HTML Code:
<form class="vbform block" action="teams.php?do=addfreeagent" method="post"> PHP Code:
|
Try TYPE_ARRAY
Also serialize $game before saving it to the db |
It's because you're sending an array of values to the server.
$vbulletin->input->clean_array_gpc('p', 'game', TYPE_STR); $vbulletin->GPC['game']; should then contain the games separated by commas. |
Quote:
Quote:
Thank you both for the replies. |
Does anyone have any ideas how to resolve this I've spent a lot of time on this script and fixed everything but this issue. I added regular text fields without issue, I never thought a simple checkbox selection would cause this much trouble. I'm sure the form HTML itself is fine it's just the PHP code handling the submission I'm not sure about.
I tried looking into the serialization of $game but it's over my head. |
All times are GMT. The time now is 03:24 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|