I have a dropdown menu and javascript inside index.html. For clarity I removed most of the options (there're over 20). It sends the dropdown menu selection to engine.php
index.html
<script>
function refreshpage(e)
{
var e = document.getElementById("sr");
var snk = e.options[e.selectedIndex].value;
window.location.href = "engine.php?selectedOption=" + snk;
}
</script>
<h4>Select your option</h4>
<form action="" id="optionform" onsubmit="return false;">
<select class="item_options" id="sr" name='sr' onchange="refreshpage(this);">
<option value="None">Select option</option>
<option value="Option1">Option 1</option>
<option value="Option1">Option 2</option>
<option value="Option1">Option 3</option>
</select>
</form>
When you select an option, it sends the option to engine.php
engine.php
<?php
$option1 = 5;
$option2 = 10;
$final = array($option1, $option2);
if($_GET["selectedOption"] == 'Option1')
{
$option1 = 20;
$option2 = 20;
}
?>
How can I send $final
back into index.html and use javascript to use the values in the $final
array ($option1
and $option2
). I basically want to refresh index.html
and use the new, updated values ($option1 = 20; $option2 = 20;
)