I want to call a PHP function based on information extracted from a form with javascript
hard-coded works fine:
if (x=="BSP"){
if (b){
var thecontent="<?php distincttype('BSP') ?>";
document.getElementById("BSP").innerHTML =thecontent;
}else{
document.getElementById("BSP").innerHTML ="";
}
}
What I am looking to do is change the php element depending on the content of a form element to replace the 'BSP' with the variable y
var y=document.forms["FindForm"]["myRef"].value; (assume value is "XYZ")
by creating a string variable thecontent
var thecontent="<?php distincttype('"+y+"') >?";
I can create the variable but it just doesnt work when the routine is substituted for the hard code.
Javascript remains a mystery to me so any help welcome and plkease be gentle with me
hard-coded works fine:
if (x=="BSP"){
if (b){
var thecontent="<?php distincttype('BSP') ?>";
document.getElementById("BSP").innerHTML =thecontent;
}else{
document.getElementById("BSP").innerHTML ="";
}
}
What I am looking to do is change the php element depending on the content of a form element to replace the 'BSP' with the variable y
var y=document.forms["FindForm"]["myRef"].value; (assume value is "XYZ")
by creating a string variable thecontent
var thecontent="<?php distincttype('"+y+"') >?";
I can create the variable but it just doesnt work when the routine is substituted for the hard code.
Javascript remains a mystery to me so any help welcome and plkease be gentle with me