Isnt what iam saying logical and stands true?
No. Neither. When three or four people are telling you that you are missing something obvious, you need to shake off your assumptions, and start thinking fresh. You are infact missing the obvious, and it centres on the fact that 'first' has two meanings in your code. In the case that you want to redirect the user, you already have the credentials and don't need to ask for it. Just because the user has to do it first, doesn't mean that the code has to look that way.
Your code runs twice. Think of it as having two modes, which aren't really dependent on each other.
| [reply] |
I think i got it now :-)
a) table is printed on screen awaiting data(thats the first run of my login.pl script
b) client fills the form and submit it. Here is the tricky part. After this point, the 2nd run of login.pl, the user has already given the script the credentials so i can check them against the database without needed to print anything ont he screen and just redirect the suer in case thei are correct.
I was pretty stuck in the idea that "Just because the user has to do it first, doesn't mean that the code has to look that way.". I was thiniking that because i was askign the use to fill stuff,hence print header was issued" then no redirect would work afterwards.But now i relised that the if (redirect) structure its ok to come first.
If the sue has given out data and thay re ok, the user will be redirected withoutme have to rpitn anything, if he didnt post data than i would just print him the user inut table.
Damn, when iam stuck at something i really cant think fresh as you wisely saud. Phew, its ok i got it now! :-)
Thank you all!
| [reply] |