0
I’m having a problem calling a show by PHP
passing parameters.
Code:
<?
print("<script language=javascript>
alert(\" <<< Dados Alterados com Sucesso! >>>\");
if($w_rec != "")
{
if (confirm(\"Deseja alterar as demais opções?\") == true)
{
location.replace(\"../sai_cada_peri/sai_frm_alte_peri.php?$w_rec+$w_cont\");
}
else{
parent.location.replace(\"../sai_cada_peri/sai_alte_peri.php\");
}
}
else{
parent.location.replace(\"../sai_cada_peri/sai_alteperi.php\");
}
</script>");
?>
In this excerpt from PHP
he will check whether the $w_rec
is empty, and if so and the user confirms it will call another program by passing these parameters. My problem is .. How to pass these parameters in this call?
The call I’m referring to would be on that line:
location.replace(\"../sai_cada_peri/sai_frm_alte_peri.php?$w_rec+$w_cont\");
Obs* The whole show is just PHP
.
But... this is Javascript! Is the problem not only the lack of quotes and escape in
if($w_rec != "")
? Tryif('$w_rec' != '')
– bfavaretto
Yes, in itself this part is a Javascript! But the variables I want to pass are in PHP Location.replace(".. /sai_cada_peri/sai_frm_alte_peri.php? $w_rec+$w_cont");
– Bruno
It is not clear what the problem is. If you are giving error in this JS, I think it is better to post the code generated by PHP (the output that the browser sees).
– bfavaretto
I suppose it can’t be the case with quotation marks. As @bfavaretto asked me to try, the program still doesn’t run!
– Bruno
But we need to see the output of this PHP to better understand! From a "display source code" in your browser and post the JS that your PHP spat.
– bfavaretto
Yes it was a quote problem. I’m sorry for the problem, it was giving error because I did not put the quotes in the parameter passage (".. /sai_cada_peri/sai_frm_alte_peri.php? '$w_rec'+'$w_cont'");
– Bruno
This question seems to be decontextualized because it is about a specific problem and will not help anyone else.
– Jorge B.
This question is being discussed at the goal: http://meta.pt.stackoverflow.com/q/1957/7210
– Jorge B.