I need to execute some php code when a user clicks on a link. I found an answer here and I wrote this in the site header:
<script type="text/javascript">
function sottoponi() {
$.get("sottoponi.php");
return false;
}
</script>
this in the body, where I need the code:
<a href="#" onclick="sottoponi();">Prova</a>
And then I wrote this on sottoponi.php
<?php
$variable= value;
if ($variable < 1) {
// do some php code;
}
else if ($variable > 1) {
$jav1 = <<<MAR1
<script language="javascript" type="text/javascript">
alert("Error!");
</script>
MAR1;
echo $jav1;
}
?>
I'm sure I'm doing it wrong, because I don't get the alert (and I'm sure $variable > 1 is true, I echoed the variable!): how can I pass information from sottoponi.php to the actual page?