Your question is a little confusing. You wrote "else part is executing properly" which implies that your if test on myflag is executing properly, but then you write "but flag is not working" which implies that the if test on myflag is not executing properly.
I would try removing the "/" from the end of the href, that is not a valid parameter separator.
Oh, and you do know that when you use a link with an href that only the URL in the href is invoke? In other words, no other data is passed along, which means that there will be no studID value. If you want to send a studID value, you should use a form with a submit button.
Are you sure that your get myflag is supposed to return "true" string instead of just true as a boolean. I cannot remember if this matters or not. Also, it would help to see the form that is posted to show the get variables possible values.