MTavares Posted July 18, 2012 Report Share Posted July 18, 2012 Olá colegas...minha mente tá bloqueada :lol: . Tenho o seguinte código:<input type="checkbox" name="dados[]" value="1"> <input type="checkbox" name="dados[]" value="2"> <input type="checkbox" name="dados[]" value="3"> pego esses valores com PHP: $dados = $_POST["dados"]; foreach($dados as $d) { $d = $d. ","; }Até aqui tudo bem, ok, funciona, funciona.... mas... como faço para retirar a maldita da vírgula que fica no final da variável??!?!?!? kkkkkkkkkkkkVlw Quote Link to comment Share on other sites More sharing options...
0 ESerra Posted July 18, 2012 Report Share Posted July 18, 2012 Mais simples...$dados = implode(',',$_POST["dados"]);Caso o post possa vir sem este dados, coloque uma @ para suprimir o erro que o implode vai retornar... Quote Link to comment Share on other sites More sharing options...
0 MTavares Posted July 18, 2012 Author Report Share Posted July 18, 2012 Show ESerra...funcionou perfeitamente...Obrigadão..Abraços Quote Link to comment Share on other sites More sharing options...
0 JaguA Posted July 18, 2012 Report Share Posted July 18, 2012 pode usar o substr ("$d", 0, -1) ele retira o ultimo caracter (no sue caso a virgula)eu não sabia desse que o ESerra postou achei bem interessante. Quote Link to comment Share on other sites More sharing options...
Question
MTavares
Olá colegas...
minha mente tá bloqueada :lol: . Tenho o seguinte código:
pego esses valores com PHP:Até aqui tudo bem, ok, funciona, funciona.... mas... como faço para retirar a maldita da vírgula que fica no final da variável??!?!?!? kkkkkkkkkkkk
Vlw
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.