Heja,
I’m currently running a osTicket site for my department at work just to make ticket handling easier.
Though I’ve got one problem with our Radio buttons - the form won’t remember what radio button I chose if I get any errormsg.
So my current code is:
<tr>
<td><b>Återkoppla till kund? </td>
<td>
<input name='aterkom[]' type=radio value="Ja">Ja
<input name='aterkom[]' type=radio value="Nej">Nej
<font class="error">* <?=$errors['aterkom']?></font>
</td>
</tr>
What I’ve done to try make it work:
<tr>
<td><b>Återkoppla till kund? </td>
<td>
<?
$aterkomja_checked = (isset($_POST['aterkom[]']) && $_POST['aterkom[]'] == 'Ja') ? 'checked' : '';
$aterkomnej_checked = (isset($_POST['aterkom[]']) && $_POST['aterkom[]'] == 'Nej') ? 'checked' : '';
?>
<input name='aterkom[]' type=radio value="Ja" <?=$aterkomja_checked?>>Ja
<input name='aterkom[]' type=radio value="Nej" <?=$aterkomnej_checked?>>Nej
<font class="error">* <?=$errors['aterkom']?></font>
</td>
</tr>
But the form still doesn’t remember the radio buttons.
and if I remove the brackets out of input name=‘aterkom[]’ and on isset($_POST[‘aterkom[]’ it works great with remembering the radio buttons!
The only problem is that then the information won’t get to the database.
Do anyone of you have any clue on what I should do? Can I somehow use the closed brackets in my isset?
Or can I come around with removing the closed brackets and still make it populate with the database?
Here’s the whole script:
http://www.openscriptsolution.com/ticket-system/osticket/how-to-add-extra-fields-on-the-open-ticket-form-of-client-side-in-osticket-v1-6-rc5/
Thanks a lot in advance!
Best regards,
PleXy