I'm looking for a method of using the value of a variable from Javascript to use it as the "WHERE" clause in my SQL search which is built in PHP within the JS function.
I got it to display the value that was selected from the drop-down that calls the function properly, so I know it's passing it correctly, I just can't figure out how to get it to use the value.
You can find what I'm working on here. It's the one on the right under "Group 3".
This is my function now:
[HTML]<SCRIPT language="JavaScript">
<!--
function nameChange(Name){
<?php
$dbh = mysql_connect ("localhost", "name", "password") or die ('Database Connection Error: ' . mysql_error());
mysql_select_db ("database");
$query = "SELECT * FROM Users WHERE Number='$number'";
$sql = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($sql)
?>
var memberName = Name;
var strName = "The name is: "+memberName+"<br />";
strName = strName+"First Name:<input type='text' name='fname' size='20' value='<?php $row['FirstName'] ?>'>";
strName = strName+"<br>Last Name:<input type='text' name='lname' size='20' value='<?php $row['LastName'] ?>'>";
document.getElementById("divName").innerHTML = strName;
}
// -->
</SCRIPT>[/HTML]