John Davidson

session in mvc model in guessing number game PHP

0 comments
Message:


the session after sending the form changes the number to another. Instead of the first one chosen by rand.


$correctNum = rand(1,5);
$_SESSION["correct"]=$correctNum;

if(!isset($correctNum)){
$correctNum = rand(1,5);
$_SESSION["correct"]=$correctNum;
}

if ($correctNum==|number from the form|){
echo "Win";
session_unset();
session_destroy();
}


My Answer:
'correctNum'] = $correctNum;

Rate this post

4 of 5 based on 8434 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us