Using Session...hot to do that?
My application wants user to register himself on first page and then it transfers it to second page wherein he has to fill-up employee information.So,I've written this code to generate company-id which wud then be assigned to that particular company like this--
strSQL="SELECT MAX(CompanyId)+1 as maxval FROM MASTER"
response.write "company-id=" &CompanyId
If IsNull(CompanyId) then
CompanyId = 1
'SET VARIABLES FROM FORM
I am taking values of the other variables from html code written above to this asp code.
after the insert query I am redirecting the user to next page named emp_info1.asp this way--
On emp_info1.asp , m tryin to generate employee-id by using same sql query I used for generating Company-id.It is working fine.But now the problem is that I want to insert this employee-id along with other details and Company-id too , in the employee table.I am using this query for generating employee-id ---
strSQL="SELECT MAX(EmpId)+1 as maxval FROM EMPLOYEE WHERE CompanyId='" & str & "'"
Now the problem is that I've tried every possible method to get the value of company-id from previous page.But the value of company-id that is being inserted in database each time is 0.This means form is not getting value for company-id from previous page.I tried both form methods- get and post. I also tried session's concept. But nothing seems to be working. I think session concept wud be gud because it wud be helpful in implementing checks on further pages of my website.But m not so clear with it.
What I did to implement session's concept is that I wrote this stmt in global.asa--
then on first page where I want user to get registered, I assigned company-id generated in session variable like this--
and on second page where I am retrieving company-id from previous page, I wrote--
But even after all this, m unable to get company-id value in str from previous page.
What shud I do now??? Can anyone help???