I'm trying, so far unsuccessful to make a function to change the name of a hidden input based upon the country of the user, i have some php code that determines there country of origin of the user fine. I then have a small java script function to change the name of the hidden input depending on the country of origin.
The php variable that holds the country of origin is $country; that variable then needs to be assigned to x in my java script function. $country is equal to AU if your in Australia and US if your in America.
<script type = "text/javascript">
function changelist() {
var x = "<?php echo $country;?>";
if (x == "AU") {
document.getElementById("theHiddenInput").name = "SelectLists[41]"};
else if (x == "US") {
document.getElementById("theHiddenInput").name = "SelectLists[43]"};
}
</script>
<input type="hidden" id="theHiddenInput" name="SelectLists[41]" value="Yes">
If anyone has any tips or pointers as to what I'm doing wrong, I'd greatly appreciate it,
Thanks.

New Topic/Question
Reply



MultiQuote




|