Hi all,
Here are the three ideas that I was or am investigating:
Idea 1 - Closed :
input javascript code within the <a href="country_edit.php?data=document.form.myoption.value"> to send the value of the option to the php script.
This is not working, the javascript code is not evaluated
Idea 2 - Ongoing :
Perform a 'fake submit' of the form to be able to access the value in the second script and then cancel the submit
Should look like (code is wrong, just putting ideas on screen):
<script>
function fakeSubmit() {
form.submit();
document.go(scriptPHP);
}
function validateSubmit() {
if (fakeSubmit) return false;
else return true;
}
</script>
...
<form action="submitScript.php" onSubmit="validateSubmit()">
...
<a href="javascript:fakesubmit()">test</a>
...
</form>
Idea 3 - To investigate
Temporary save the option value in the database (meaning even if not the correct option value for the record): submit the form but do not insert or update the definitive record, just a temp one to save the value of the option to work on.
Once processing of the option value is over, insert or update the db record with the true values
More coming soon ...
Mike Simonelli wrote:
Is there an easy way to "share" a variable between javascript and PHP on a page that contains both languages? I can probably go one way with:
java_var = "<? echo $php_var; ?>;"
however, I need to go the other way... from a java variable (select.selectedIndex to a php var) to use in a select onChange javascript handler... the PHP script inside this handler needs to know which index is currently selected in the select form element.
Any ideas ??