Witam,
unikając Ajax'a chciałbym wysłać zmienną z JS do pliku PHP. Wymyśliłem więc taki sposób:
var sound;
function start()
{
if(confirm("Sound on page?"))
{
sound = true;
document.getElementById("form").action = "fear.php?sound=true&";
}else{
sound = false;
document.getElementById("form").action = "fear.php?sound=false&";
}
}
<form id="form" method="get">
<input type="text" name="value" id="in" placeholder=" Number" />
<br /><input type="submit" id="send" value="Send!" />
</form>
Problem polega na tym, że kiedy w formularzu wpiszę np. 8 submit odsyła do strony fear.php?value=6 pomijając zmienna sound.
Co robić i czy ten pomysł w ogóle wypali?
Pozdrawiam