update mysql and php then this code not work

can not pass variable userid



if(!isset($userid)) {
   login_form();
  echo "test51"  ;    

the full code is below how can i fix it


<HTML>
<HEAD>
<TITLE>Login</TITLE>
</HEAD>
<BODY>
<FORM METHOD="POST" ACTION="<?php echo $PHP_SELF ?>">
   <DIV ALIGN="CENTER"><CENTER>
      <H3>Please log in to access the page you requested.</H3>
   <TABLE BORDER="1" WIDTH="200" CELLPADDING="2">
      <TR>
         <TH WIDTH="18%" ALIGN="RIGHT" NOWRAP>ID</TH>
         <TD WIDTH="82%" NOWRAP>
            <INPUT TYPE="TEXT" NAME="userid" SIZE="8">
         </TD>
      </TR>
      <TR>
         <TH WIDTH="18%" ALIGN="RIGHT" NOWRAP>Password</TH>
         <TD WIDTH="82%" NOWRAP>
            <INPUT TYPE="PASSWORD" NAME="userpassword" SIZE="8">
         </TD>
      </TR>
      <TR>
         <TD WIDTH="100%" COLSPAN="2" ALIGN="CENTER" NOWRAP>
            <INPUT TYPE="SUBMIT" VALUE="LOGIN" NAME="Submit">
         </TD>
      </TR>
   </TABLE>
   </CENTER></DIV>
</FORM>
</BODY>
</HTML>
<?php
}




if(!isset($userid)) {
   login_form();
  echo "test51"  ;
//   exit;
}
// main else when have log in then process
else {

Open in new window

teeraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

teeraAuthor Commented:
this is the full code  when I up grade php id does not work
0
Loganathan NatarajanLAMP DeveloperCommented:
I think the above code is not full.. it is broken?
0
Julian HansenCommented:
What are you asking?

The php code is obviously not complete.

$userid is being used but not set - assuming you are getting the value from the POST ($_POST['userid'])

Where does MySQL come into it

Please take the time to phrase your question properly so we are able to assist you.
0
Chris StanyonWebDevCommented:
It's probably because SuperGlobals were enabled in your old version of PHP, and disabled in the new version. Instead of accessing POST variables simply by their name, you have to access them through the array. So instead of:

if(!isset($userid)) {

You need to use:

if(!isset($_POST['userid'])) {

As others have said though - if that really is your complete code then it's broken in several places!
0
Ray PaseurCommented:
We know that cannot possibly be the "full code" because it contains a parse error, and would never have run on any PHP configuration.  But that aside, I think @ChrisStanyon has got a pretty good lead on the problem.  This article explains it.  You're not the only one who thought that "PHP just works this way."

http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_7317-Register-Globals-a-bad-idea-from-day-one.html
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.