0
I have the following variable in JS
: m_aluno[w_cont_i][w_cont_j][w_cont_k]
; Where in each posição
hers (0,0,0)
i added a value! My question is:
"How to take this variable and move on to the next program the same way it is and then add it back to JS so it can display the same way."
Code:
<?php
//Monta o array
print("<SCRIPT language=javascript>
w_ii = \"$w_cole\"; //valor suposto = 2
m_aluno = new Array(w_ii); // numero de colegios
w_jj = \"$w_sala\"; //valor suposto = 2
for (w_i=0; w_i<=w_ii; w_i++)
{ m_aluno[w_i] = new Array(w_jj);} // Numero de salas
w_kk = \"$w_mate\"; //valor suposto = 2
for (w_i=0; w_i<w_ii; w_i++)
{
for (w_j=0; w_j<w_jj; w_j++)
{ m_aluno[w_i][w_j] = new Array(w_kk); } // numero de materias
}
w_cont_i = 0; w_cont_j = 0; w_cont_k = 0;
w_cont_cole = \"$w_cole\"; w_cont_sala = \"$w_sala\"; w_cont_mate = \"$w_mate\";
</SCRIPT>");
?>
Inserts values according to what the user types:
function f_inse_alun()
{
w_form ="frm_cad_op1";
w_nome = document.forms[w_form].tx_nome.value;
m_aluno[w_cont_i][w_cont_j][w_cont_k] = w_nome;
if (w_cont_k <= (w_cont_mate-1)) // se materia for menor entra
{
w_cont_k++; // incrementa a materia
}
if ((w_cont_j <= (w_cont_sala-1)) && (w_cont_k > (w_cont_mate-1))) // se sala for menor entra
{
w_cont_k=0;
w_cont_j++; // incrementa a sala
}
if ((w_cont_i <= (w_cont_cole-1)) && (w_cont_j > (w_cont_sala-1))) // se colegio for menor entra
{
w_cont_j=0; // sala
w_cont_k=0; // materia
w_cont_i++; // incrementa o colegio
}
if (w_cont_i > (w_cont_cole-1))
{
alert("//chamar o programa para mostrar;");
parent.location.replace("../Array/arrays_2.php?m_aluno="+m_aluno);
//vai ser usado para mostrar no outro form
}
return true;
}
</script>
Noting that at the last if
I mount a call to pass the array
, but it was flawed!
you should review your question because it is not clear what you are asking. Send an array to another program? You do not mean function?
– CesarMiguel
Yes an array. I mount an array with 3 dimensions where at each position of it I enter a value, I wish I could pass that array! If case got a little confused my question I put the code running!
– Eduardo
That’s not the question. The question is where you want to send the array
– CesarMiguel
Oh yes sorry! I want to pass the array to a next program to be able to display it! Via POST/GET!
– Eduardo
@Eduardo puts more code and description of the problem. I think you need
JSON.stringify(m_aluno)
but without knowing more I’m guessing...– Sergio
@Sergio will post the code that mounts the array and adds the positions for better understanding!
– Eduardo
this question has already been asked and it has already been closed here http://answall.com/q/40211/3082 I believe that editing the original question so that it is in accordance would be better.
– Paulo Roberto Rosa
@Pauloroberto this question is different! Because the doubt I had in the other question I managed to resolve, but this is not the same thing!
– Eduardo
Both one question and the other I can’t clearly understand what you’re asking, so I can’t tell them apart because to me you’re talking about the same thing, don’t feel offended, I’m just trying to help at the point where you edit your question for a better understanding of it.
– Paulo Roberto Rosa