<script>
//verifico se il titolo non contiene gia il redirect
var get = parseGetVars();
var redirect = get['fig'];
////////////////////////////////////////////////////////////////
if(redirect == null | redirect == "") {
b=prompt("Inserire valore 'Base'");
h=prompt("Inserire valore 'Altezza'");
a=prompt("Inserire valore 'Area'");
tot = "" + b + "-" + h + "-" + a; //Testo da mostrare in debug
document.write("=====DEBUG====<br>" + tot +
"<br><===========><br><br>");
location.href="calc.php?fig=1&b=" + b + "&h=" + h + "&a=" + a;
} else { }
function parseGetVars()
{
var args = new Array();
var query = window.location.search.substring(1);
if (query)
{
// divido la querystring in blocchi sulla base del carattere &
// (il carattere & è usato per concatenare i diversi parametri della URL)
var strList = query.split('&');
// faccio un ciclo per leggere i blocchi individuati nella querystring
for(str in strList)
{
// divido ogni blocco mediante il simbolo uguale
// (uguale è usato per l'assegnazione del valore)
var parts = strList[str].split('=');
// inserisco nella array args l'accoppiata nome = valore di ciascun
// parametro presente nella querystring
args[unescape(parts[0])] = unescape(parts[1]);
}
}
return args;
}
</script>
<br>
-----------
<br>
<?
$fig = $_GET[fig];
$b = $_GET[b];
$a = $_GET[a];
$h = $_GET[h];
//////////////// test php
echo "$fig, $a,$b,$h";
?>