Oneber 0 Denunciar post Postado Fevereiro 17, 2010 Pessoal, estou tentando alterar um codigo php na unha. Originalmente ele é um componente para joomla, onde se cadastra carros com suas devidas caracterirsticas e é apresentado no site atravéz de categorias ou resultado de busca. mas preciso cadastrar escritórios de advocacia com algumas detalhes pré definidos. Eu substitui o que antes era tipo de combustível, (e se selecionava apenas um item) por áreas de atuação ( que preciso que seja multipla escolha). Transformar o formulário em multipla escolha, consegui, mas os dados selecionados no formulário, não são salvos no BD. salva apenas o ultimo selecionado e não todos os que selecionei. na pagina do formulário está assim: <tr> <td align="right" class="key"><font color="#000000"><?php echo JText::_( 'FUEL USED' ); ?></font></td> <td><?php echo $this->lists[fuel]; ?></td> </tr> Que puxa este código: ## Filling the Array() for fueltypes and make a select list for it. $fuel = array( '1' => array('value' => '1', 'text' => JText::_( 'CIVIL' )), '2' => array('value' => '2', 'text' => JText::_( 'COMERCIAL' )), '3' => array('value' => '3', 'text' => JText::_( 'CONSUMIDOR' )), '4' => array('value' => '4', 'text' => JText::_( 'FAMILIA' )), '5' => array('value' => '5', 'text' => JText::_( 'IMOBILIARIO' )), '6' => array('value' => '6', 'text' => JText::_( 'INTERNET' )), '7' => array('value' => '7', 'text' => JText::_( 'PENAL' )), '8' => array('value' => '8', 'text' => JText::_( 'PROPRIEDADE INTELECTUAL' )), '9' => array('value' => '9', 'text' => JText::_( 'SOCIETARIO' )), '10' => array('value' => '10', 'text' => JText::_( 'TRABALHO' )), '11' => array('value' => '11', 'text' => JText::_( 'TRIBUTARIO' )), ); $lists[fuel] = JHTML::_('select.genericList', $fuel, 'fueltype', ' class="checkbox" '.'multiple', 'value', 'text', $items->fueltype); o fueltype: function fueltype($fueltype){ if ($fueltype == 1) { $fueltype = JText::_( 'CIVIL'); } if ($fueltype == 2) { $fueltype = JText::_( 'COMERCIAL'); } if ($fueltype == 3) { $fueltype = JText::_( 'CONSUMIDOR'); } if ($fueltype == 4) { $fueltype = JText::_( 'FAMILIA'); } if ($fueltype == 5) { $fueltype = JText::_( 'IMOBILIARIO'); } if ($fueltype == 6) { $fueltype = JText::_( 'INTERNET'); } if ($fueltype == 7) { $fueltype = JText::_( 'PENAL'); } if ($fueltype == 8) { $fueltype = JText::_( 'PROPRIEDADE INTELECTUAL'); } if ($fueltype == 9) { $fueltype = JText::_( 'SOCIETARIO'); } if ($fueltype == 10) { $fueltype = JText::_( 'TRABALHO'); } if ($fueltype == 11) { $fueltype = JText::_( 'TRIBUTARIO'); } return $fueltype; } e o BD foi criado com esta estrutura: `fueltype` tinyint(1) NOT NULL, Sei que muitas pessoas não gastam tempo ajudando iniciantes, mas se alguem puder me ajudar, agradeço desde já. Compartilhar este post Link para o post Compartilhar em outros sites
William Bruno 1501 Denunciar post Postado Fevereiro 21, 2010 Se você precisa salvar vários dados no BD, a melhor forma seria aplicar uma normalização de dados, e separar essa entidade numa outra tabela. Como está ficando a tua string de INSERT ? Compartilhar este post Link para o post Compartilhar em outros sites