1
My code is this down here:
<html>
<body>
<form method="post" action="recebe.php" >
<input type="hidden" id="send_string_array" name="send_string_array" value="" />
<input type="submit" value="Enviar" />
</form>
</body>
<head>
<script>
//variáveis
var array_produtos = Array([1,2,3,4,5,6]);
var i, array_produtos, string_array;
//varre o array só pra mostrar que tá tudo ok
for (i in array_produtos)
alert(array_produtos[i]);
document.getElementById("send_string_array").value = array_produtos.join("|");
</script>
</heady>
</html>
The code PHP
that should work and show the array is this:
<?php
//transforma a string de itens separados em array
$array_produtos = explode("|", $_POST['send_string_array']);
//mostra o conteúdo do array
echo $_POST['send_string_array'];
?>
The PHP
is returning to me this Array ( [0] => );
, but should contain the values in the array, no?
What would be my mistake?
Adailton your new edition has just removed the line I commented below about being the problem, with this current code remains the problem?
– Maicon Carraro
is because Voce responded while I was editing was bad.
– adailton moraes