gwolff2005 Posted April 15, 2009 Share Posted April 15, 2009 hi guys, maybe something really simple, but i dont get it. I declare variables at the beginning of the session. Later I want to show a graph to the user (if the data is in mysql), if they are not stored in mysql a text should come up, saying: "You need to do the test." Still it does not work. My session variable is $_SESSION['MM_resultsmo'] = $row['resultsmo']; and my code is: if (!empty(MM_resultsmo)){ echo "You need to do the test"; } else { echo " " . $_SESSION['MM_resultsmo']; } What is wrong??? Link to comment https://forums.phpfreaks.com/topic/154185-solved-input-validation-error/ Share on other sites More sharing options...
trq Posted April 15, 2009 Share Posted April 15, 2009 if (!empty($_SESSION['MM_resultsmo'])) { echo "You need to do the test"; } else { echo " " . $_SESSION['MM_resultsmo']; } Link to comment https://forums.phpfreaks.com/topic/154185-solved-input-validation-error/#findComment-810529 Share on other sites More sharing options...
gwolff2005 Posted April 15, 2009 Author Share Posted April 15, 2009 That does not work. Even the variable is in the database it just shows "You need to do the test. As a control I displayed the variabel in another field next to it, so the variable works, but not in this code. Link to comment https://forums.phpfreaks.com/topic/154185-solved-input-validation-error/#findComment-810570 Share on other sites More sharing options...
mrMarcus Posted April 15, 2009 Share Posted April 15, 2009 That does not work. Even the variable is in the database it just shows "You need to do the test. As a control I displayed the variabel in another field next to it, so the variable works, but not in this code. it would .. !empty() is like saying, "not empty". think about it. if (empty($_SESSION['MM_resultsmo'])) { echo "You need to do the test"; } else { echo " " . $_SESSION['MM_resultsmo']; } Link to comment https://forums.phpfreaks.com/topic/154185-solved-input-validation-error/#findComment-810582 Share on other sites More sharing options...
gwolff2005 Posted April 15, 2009 Author Share Posted April 15, 2009 @mrmarcus: Ahh got it. I'll try. Link to comment https://forums.phpfreaks.com/topic/154185-solved-input-validation-error/#findComment-810583 Share on other sites More sharing options...
gwolff2005 Posted April 15, 2009 Author Share Posted April 15, 2009 great it works!! thanks! Link to comment https://forums.phpfreaks.com/topic/154185-solved-input-validation-error/#findComment-810586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.