My inaugural post!
I'm trying to allow the user to select an option from the working drop down box, and view the contents of that record on the following screen. So the file needs to grab this selected record and save it in a variable, which is then passed along once the user hits submit.
This is the code from the select screen (minus the irrelevant functions) -->
<?php
while (list($key, $val) = @each($HTTP_POST_VARS)) {
$GLOBALS[$key] = $val;
}
function Output_Entries()
{
echo "
<FORM METHOD=post ACTION=\"SDAHW.php\">
Please enter the details you wish to be inserted into the Access Database.<br>
<table border=1><tr>";
$cnx = odbc_connect( 'AHW' , 'root', '' );
if(!$cnx)
{
Error_handler( "Error in odbc_connect" , $cnx );
}
$cur= odbc_exec( $cnx, "select AGSNum from AHW" );
if( ! $cur )
{
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
echo "<td>";
echo "<select name=\"AGSNUMID\" size=\"1\">";
while( odbc_fetch_row( $cur ) )
{
$AGSNum= odbc_result( $cur, 1 ); // get the field "AGSNum"
print "<option value=\"$AGSNUM\">$AGSNum</option>\n";
}
echo "
</td></tr></table>
<INPUT type=\"Submit\" value=\"Enter Information\">
</form>
";
?>
</select>
<?
odbc_close( $cnx);
}
HTML_Head();
Output_Entries();
HTML_Foot();
?>
This is the page which gets the records (again, minus the irrelevant functions)-->
echo "
<HTML><HEAD>
<TITLE>Processing Form</TITLE>
</HEAD>
<BODY BGCOLOR=\"#D5D5AB\">";
}
function Output_Entries($AGSNUMID)
{
$cnx = odbc_connect( 'AHW' , 'root', '' );
if(!$cnx)
{
Error_handler( "Error in odbc_connect" , $cnx );
}
$cur= odbc_exec( $cnx, "select AGSNum, FirstName from AHW WHERE AGSNum=$AGSNUMID" );
if( ! $cur )
{
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
echo "<table border=1><tr><th>AGS Number</th><th>First Name</th></tr>\n";
echo "<tr><td>$AGSNum</td><td>$FirstName</td></tr>\n";
echo "</table>";
odbc_close( $cnx);
}
?>
And the errors I'm getting are:
Notice: Use of undefined constant AGSNUMID - assumed 'AGSNUMID' in C:\Program Files\Apache Group\Apache2\htdocs\TEST\Mini\SDAHW.php on line 56
Warning: SQL error: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1., SQL state 07001 in SQLExecDirect in C:\Program Files\Apache Group\Apache2\htdocs\TEST\Mini\SDAHW.php on line 39
Error in odbc_exec( no cursor returned )