Allenph9 Posted February 25, 2012 Share Posted February 25, 2012 $test = substr_count($_POST['signature'], '>'); $test1 = substr_count($_POST['signature'], '<'); if ($_SESSION['logged_in'] != '1') { static $the_echo = 'You need to be logged in!'; } elseif ($_POST['change_box2'] != 'CHANGE') { static $the_echo = 'You must fill in the "CHANGE" box!'; } elseif ($test != '0') { static $the_echo = 'Contains illegal characters!'; } elseif ($test1 != '0') { static $the_echo = 'Contains illegal characters!'; } } echo $_POST['signature']; echo $test; ?> Those two echos a few lines above (echo $_POST['signature']; and echo $test;) come out to The Little Android and 0 yet it still echos illegal characters...what? Quote Link to comment https://forums.phpfreaks.com/topic/257749-it-equals-zero-but-im-still-getting-an-echo/ Share on other sites More sharing options...
requinix Posted February 25, 2012 Share Posted February 25, 2012 Why are you using "static"? Quote Link to comment https://forums.phpfreaks.com/topic/257749-it-equals-zero-but-im-still-getting-an-echo/#findComment-1321056 Share on other sites More sharing options...
Allenph9 Posted February 25, 2012 Author Share Posted February 25, 2012 because it dosnt echo till further down but all i do further down is call <?php echo $the_echo; ?> Quote Link to comment https://forums.phpfreaks.com/topic/257749-it-equals-zero-but-im-still-getting-an-echo/#findComment-1321057 Share on other sites More sharing options...
requinix Posted February 25, 2012 Share Posted February 25, 2012 Do you know what "static" does? Quote Link to comment https://forums.phpfreaks.com/topic/257749-it-equals-zero-but-im-still-getting-an-echo/#findComment-1321059 Share on other sites More sharing options...
Allenph9 Posted February 25, 2012 Author Share Posted February 25, 2012 To tell you the truth no...i assumed that it allowed static to be called from one class (<?php ?>) to another Quote Link to comment https://forums.phpfreaks.com/topic/257749-it-equals-zero-but-im-still-getting-an-echo/#findComment-1321061 Share on other sites More sharing options...
requinix Posted February 25, 2012 Share Posted February 25, 2012 You're a bit right but mostly wrong. static is an object-oriented thing, yes, but <?php blocks are not classes. If you're staying in the same file you don't need to "static" anything. The <?php blocks only control when PHP works; leaving one and entering another later won't affect your variables. Quote Link to comment https://forums.phpfreaks.com/topic/257749-it-equals-zero-but-im-still-getting-an-echo/#findComment-1321063 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.