I have a db with several related tables (userid is the related field in all tables). The db info is received from various forms on several pages of a website. The first form accepts userid and username. I'm able to pass this from the form page to the SQL Input statement, but then the value of the variable is gone and I'm unable to pass it to the next form and the associated Input statement.
I've attempted passing through the form as recommended in this solution; however, I receive a parse error message when attempting to assign the value in the form on the subsequent pages 2.
page 1
function HTML_Form() {
echo "
<FORM NAME = \"personal\" METHOD=post ACTION=\"modelsel.php3\">
Enter Details <br>
User ID: <input name=\"UserID\" TYPE=\"text\" SIZE=\"25\"><br>
page 2
function Enter_New_Entry($UserID,$Password,$FirstName,$LastName,$Street,$City,$State,$Zip,$HPhone,$WPhone) {
Global $UserID;
$cnx=odbc_connect('customer','root','');
if(!$cnx) {
Error_handler("Error in odbc_connect",$cnx);
}
$SQL_Exec_String="Insert Into Personal (UserID,Password,FirstName,LastName,StreetAddress,City,State,ZipCode,HomePhone,WorkPhone)
Values('$UserID','$Password','$FirstName','$LastName','$Street','$City','$State','$Zip','$HPhone','$WPhone')";
$cur=odbc_exec($cnx,$SQL_Exec_String);
function HTML_Form() {
echo "
<FORM NAME = \"modelsel\" METHOD=post ACTION=\"elavsel.php3\">
Enter Details <br>
<input name=\"UserID\" type=\"hidden\" value="<%=$UserID;%>
page 3 and so on will be almost identical to page 2 in that I will need to continue carrying the UserID forward to the next page and having it submitted to the db via the SQL statement.
I'm thinking that the reason this solution does not work for me, relates to the use of the SQL statement to submit the data. Is there anyway to use the data for both the SQL statement and the new form?
As a newbie to PHP, any help would be appreciated.