Welcome Guest, Not a member yet? Register   Sign In
Problem with Checkbox
#1

[eluser]Halan Batista[/eluser]
English=>
How are you?

I have a big question that I can not solve.

I registered in my database, some options such as: Sports, Leisure, Running, Traveling, Playing and more ... These options are shown as a checkbox which you choose your options and these are stored in your profile.

My problem is this ... I have the options mentioned above and I have the options the user selected, how do I pull all the options and see what the user selected marked?

I started the chebox like this:

Code:
<?php $i=0; foreach($perfil_interesses AS $pi) : ?>
                                <!--Campo form ponto -->
                                <div class="campo_form_ponto">
                                    &lt;input type="checkbox" name="interesses[]" value="&lt;?php echo $pi-&gt;id_interesse; ?&gt;" checked="checked" /&gt;
                                    <label for="&lt;?php echo $pi-&gt;permalink; ?&gt;" class="label">&lt;?php echo $pi->descricao; ?&gt;</label>[color=blue][/color]
                                    <div class="clear"></div>
                                </div>
                                &lt;!-- / Campo form ponto --&gt;
&lt;?php $i++; endforeach; ?&gt;


Portugues=>
Tudo bem com vocês?

Estou com uma grande dúvida que não consigo resolver.

Tenho cadastrado no meu banco de dados algumas opções como: Esportes, Lazer, Correr, Viajar, Brincar e outras... Essa opções são mostradas como checkbox onde o usuário escolhe as suas opções e essas são armazenadas em seu perfil.

O meu problema é o seguinte... Eu tenho as opções mencionadas acima e eu tenho as opções que o usuário selecionou, como eu faço para puxar todas as opções e as que o usuário selecionou virem marcadas?

Começei o chebox assim:


Code:
&lt;?php $i=0; foreach($perfil_interesses AS $pi) : ?&gt;
                                &lt;!--Campo form ponto --&gt;
                                <div class="campo_form_ponto">
                                    &lt;input type="checkbox" name="interesses[]" value="&lt;?php echo $pi-&gt;id_interesse; ?&gt;" checked="checked" /&gt;
                                    <label for="&lt;?php echo $pi-&gt;permalink; ?&gt;" class="label">&lt;?php echo $pi->descricao; ?&gt;</label>[color=blue][/color]
                                    <div class="clear"></div>
                                </div>
                                &lt;!-- / Campo form ponto --&gt;
&lt;?php $i++; endforeach; ?&gt;




Theme © iAndrew 2016 - Forum software by © MyBB