Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $conect = mysql_connect($host,$user,$senha) or die ("deu merda!!!");
- $ok = mysql_select_db("controleexterno",$conect);
- $query ="SELECT * FROM ins_sabores order by sabor";
- $query_comparacao = "SELECT * FROM ins_inscricao_sabores where id_inscricao='40'";
- $result = mysql_query($query);
- $result2 = mysql_query($query_comparacao);
- while ($row=mysql_fetch_array($result, MYSQL_ASSOC))
- {
- $id_drop_sabor = $row['id_sabor'];
- $sabor = $row['sabor'];
- $selected = 1;
- while($row2 = mysql_fetch_array($result2, MYSQL_ASSOC))
- {
- $id_inscricao = $row2['id_inscricao'];
- $id_sabor = $row2['id_sabor'];
- if($id_drop_sabor==$id_sabor)
- {
- $form_sabor_sorvete.="<option selected='selected' value='$id_drop_sabor'>$sabor</option>";
- $selected==0;
- }
- }
- if($selected==1)
- {
- $form_sabor_sorvete.="<option value='$id_drop_sabor'>$sabor</option>";
- }
- }
- ?>
- <form action="" method="get">
- <?php
- print "<select multiple='multiple' size='12' >";
- print $form_sabor_sorvete ;
- print "</select>";
- ?>
- <input type="submit" />
- </form>
Advertisement
Add Comment
Please, Sign In to add comment