I have an asp file which uses vbscript to connect, open and use an ADO sqlserver recordset to populate HTML form elements within the asp file. The db has (the column of interest here) entry_Status as a varchar. The asp file does successfully populate the form element with the following code of one of the form elements, as an example:
document.addform.entryStatus.value = "<%= oRS("entry_Status") %>".
Because of the security risk of vbscript for client-side db access, I want to convert the above functionality using php.
I have created a php file that successfully opens and makes an ADO recordset available to use (left in .open state) but I am not having any success in populating the form elements (as I did with vbscript above).
I have tried several different approaches including the <input ...value="<? echo $entryStatus ?>"... </input>.
I am relatively new to php and could really use help in making this conversion to php work. Clearly, I want to do ado db management as server-side code
php file. Thanks for the help. Let me know if I need to add info for more clarification.
code =
$conn = new COM ("ADODB.Connection")
or die("Cannot start ADO");
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";NetworkLibrary=".$NetworkLibrary.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
$conn->open($connStr); //Open the connection to the database
$entryStatus = '$_POST[entryStatus]';
$query = "SELECT * FROM careMinistry_test WHERE $entryStatus= '$_POST[entry_Status]'";
$rs = $conn->execute($query);
// leave the recordset open as this page redirects back to the asp file that performed a "location.href=..." to this php file.
//$rs->Close();
//$conn->Close();
//$rs = null;
//$conn = null;
$url = " to doman.org/asp file"; // not real url parameters
header("location:$url");
document.addform.entryStatus.value = "<%= oRS("entry_Status") %>".
Because of the security risk of vbscript for client-side db access, I want to convert the above functionality using php.
I have created a php file that successfully opens and makes an ADO recordset available to use (left in .open state) but I am not having any success in populating the form elements (as I did with vbscript above).
I have tried several different approaches including the <input ...value="<? echo $entryStatus ?>"... </input>.
I am relatively new to php and could really use help in making this conversion to php work. Clearly, I want to do ado db management as server-side code
php file. Thanks for the help. Let me know if I need to add info for more clarification.
code =
$conn = new COM ("ADODB.Connection")
or die("Cannot start ADO");
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";NetworkLibrary=".$NetworkLibrary.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
$conn->open($connStr); //Open the connection to the database
$entryStatus = '$_POST[entryStatus]';
$query = "SELECT * FROM careMinistry_test WHERE $entryStatus= '$_POST[entry_Status]'";
$rs = $conn->execute($query);
// leave the recordset open as this page redirects back to the asp file that performed a "location.href=..." to this php file.
//$rs->Close();
//$conn->Close();
//$rs = null;
//$conn = null;
$url = " to doman.org/asp file"; // not real url parameters
header("location:$url");