php - Verify SESSION from page to page using IF -
I am trying to verify a unique "key (in this case 303030330303)" session from the first page and its Required
Page One:
& lt ;? Php session_start (); $ _SESSION ['myValue'] = 303030330303; ? & Gt; Then the second page is considered to take this variable (with "key" 303030330303), match it against the "key" defined on the second page if it matches, then it A successful message resonates, and otherwise the error message will be resonated. Page Two: session_start (); If (($ _ session ['myValue'])) {if ($ _ session ['myValue'] == 303030330303) {echo "success"; }} And {echo "error"; }
This is what has been negligible with me, but I can not get it to work.
Thank you.
Others see the statement:
if ($ _ session [ 'MyValue'] == 303030330303; // ^ 'should be') ' Use this only by changing it:
if ($ _ session ['MyValue'] == 303030330303) In addition to this you forgot an additional 'forgot', if first statement: if (! Empty ($ _ session ['myValue']) // "If you forgot to turn off this statement
then change it to:
< Code> if (! $ _ Session ['myValue'])) {
Comments
Post a Comment