Problems with radiobuttons remain upon error

Thanks for your fast reply.
I removed the var_dump and now it looks better, everything works.
Except that it won’t populate with the database anymore. It needs the closed brackets aterkom[] to be able to send the info to the SQL server.

Unfortunately I don’t have enough skills to get this script working without the arrays. :frowning:

You need to post the code for that section.

Hey again,

I posted it on page 1 but here it comes again:
Here’s the guide that I followed: 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/
This one is for a checkbox but I use the same code but with radiobuttons.

Thanks!!!

Can you post the whole class? I can’t get a full visual of what needs to be changed based on those bits

you didnt put the last else in my code after the elseif. Add that and it should work.

Like this? Did not work either. It shows the radiobuttons, but if I dont check anything and post it, the radiobuttons disappear.
If I coded it wrong again I would be happy if you could paste the whole code.
I feel really stupid right now =/

[php]


Återkoppla till kund?
<?php if(isset($_POST['submit_x'])) { for($t=0; $t < count($_POST['aterkom']); $t++) { if($_POST['aterkom'][$t] == 'Ja') { $opt = "Ja\n Nej"; } elseif($_POST['aterkom'][$t] == 'Nej') { $opt = " Ja Nej"; } } } else { $opt = " Ja Nej"; } ?>
<?=$opt?>
&nbsp;<font class="error">* &nbsp;<?=$errors['aterkom']?></font>
</td>
</tr>

[/php]

[php][/php]

Here it is: http://webbhjalpen.com/kund/frontline/class.ticket.rar

I’m pretty sure you can just change this:

[php]
‘,aterkom=’.db_input($strapp).
[/php]

To this:

[php]’,aterkom=’.db_input($var[‘aterkom’]).[/php]

Since you would no longer be (unnecessarily) using an array

its up top, but here you go
[php]
if($_POST[‘aterkom’][$t] == ‘Ja’) {
$opt = “Ja\n
Nej”;
} elseif($_POST[‘aterkom’][$t] == ‘Nej’) {
$opt = " Ja
Nej";
} else {
$opt = " Ja
Nej";
}[/php]

Wohoo, now everything works like a charm!

I’m really glad that both of you richei and m@tt helped me out - I would never have figured this out on my own.

I’ll defenately stay in this forum!

Marked as solved, glad we could help you out :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service