petenyce105
Programmer
I have apache installed with php and mysql all works but one issue. i have a popup window that has a text box. now when user types data in it , it should search against my database and return error or the records. when i put data in and click search it goes blank? so its not looking at the database. the code below works on a linux server....
so when user types data in it does nothing and the data goes blank
Do i need to configure anyhting in config files of apache or php
Im using win 2000
Code
so when user types data in it does nothing and the data goes blank
Do i need to configure anyhting in config files of apache or php
Im using win 2000
Code
PHP:
<?php
if ($_POST['SPEC'] != "") $Surname = $_POST['SPEC'];
if ($_POST['btnSearch'] != "") $btnSearch = $_POST['btnSearch'];
if ($_POST['MemberId'] != "") $memberid = $_POST['MemberId'];
@ $db = mysql_pconnect('localhost', 'root' , '');
mysql_select_db('ehpadmin', $db) or die(mysql_error());
if (!$db) {
echo 'Error: Could not connect to database. Please try again later.';
exit;
}
if ($btnSearch == "Populate") {
$query = "select * from physician where MemberId = $memberid";
$result = mysql_query($query) or die("Error in return query<br>".$query."<br>".mysql_error ());
$myrow = mysql_fetch_array($result);
$onload = "onload=\"opener.registerForm.PLast.value='".$myrow["Last_name"]."';".
"opener.registerForm.PAddress.value='".$myrow["Address"]."';".
"opener.registerForm.Pcity.value='".$myrow["City"]."';".
"opener.registerForm.Pzip.value='".$myrow["Zip"]."';".
"opener.registerForm.spec1.value='".$myrow["SPEC"]."';".
"opener.registerForm.pstate.value='".$myrow["State"]."';".
"opener.registerForm.PPhone.value='".$myrow["Phone"]."';".
"opener.registerForm.T8.value='".$myrow["Fax"]."';".
"window.close()\"";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Search Patients</title>
<script language="javascript">
function Nice() {
if (registerForm.Surname.value.length < 3) {
alert("Enter more than three characters.");
document.registerForm.Surname.focus();
return;
} else {
document.registerForm.submit();
}
}
</script>
</head>
<body bgcolor="006666" <?php echo $onload ?>>
<?php if($Surname != "" || $Given_name != "") {?>
<?php
if ($Surname != "" && $Given_name != "") { // Both are given so use both in the search.
$listing_query = "select * from physician where SPEC like '".$Surname."%' and First_Name like '".$Given_name."%' order by Last_name, First_Name";
} else if ($Surname != "") { // Just the surname is given.
$listing_query = "select * from physician where SPEC like '".$Surname."%' order by SPEC";
} else if ($Given_name != "") { // Just the given name is given.
$listing_query = "select * from physician where First_name like '".$Given_name."%' order by Last_name, First_Name";
}
$listing_result = mysql_query($listing_query) or die("Error in return query<br>".mysql_error());
$num_rows = mysql_num_rows($listing_result);
if ($num_rows == 0) {
echo '<font color="white"><b>Please try your search again</b></font></br></br>';
echo '<font color="red">No matching records.</br></br>';
echo '<a href ="Physician-auth.html"><font color="white">Back</font></a>';
} else {
?>
<?php
echo '<font color="white"><b><p>Your search results for:</font><font color="RED"> '.strtoupper($Surname).'</p>';
?>
<form method="post" >
<font color="white">
<select name="memberid">
<option value="0"></option>
<?php
while ($listing_myrow = mysql_fetch_array($listing_result)) {
print "<option value=\"".$listing_myrow["MemberId"]."\">
".$listing_myrow["Last_name"].", ".$listing_myrow["Address"].", ".$listing_myrow["SPEC"]."</option>\n";
}
?>
</select></br>
</br><input type="submit" name="btnSearch" value="Populate">
<?php
}
?>
<font size="2" color="white"><center><b><p>Powered By Electronic Health Plans, Inc</center></b></p></font>
</form>
<?php } else { ?>
<font color="white"><h4>Physician look up by Specialty</h4></font>
<table cellpadding="0" cellspacing="0" border="0">
<form method="post" name="registerForm">
<tr>
<td> </td></font>
<td> </td>
</tr>
<tr>
<td><font color="#FFFFFF">Specialty:</font><font color="white"> </td>
<td> <input type="text" name="Surname" size="20"></td>
</tr>
<tr>
<td colspan="2" align="right">
<p align="left"> </td>
</tr>
<tr>
<td colspan="2" align="right">
<p align="left"> </td>
</tr>
<tr>
<td colspan="2" align="right"><input type="button" name="btnCheck" value="Search"onclick="Nice()"></td>
</tr>
</form>
</table>
</font>
<?php } ?>
</body>
</html>