So the new server upgraded the PHP... sucks for me because now i am having issues with code that was perfect before...

The issues i have is with my submit varables... Here is the code in question.. worked fine in php4 but not in php5... why?

if ("changeViewable" == $_POST["submit"]) {

that particular line... if you need me to post more code surrounding it... i can do so if needed...

    shouldn't that be

    if ($_POST["submit"]== "changeViewable" ) { 
    
      zrocker;10917645 wrote:

      So the new server upgraded the PHP... sucks for me because now i am having issues with code that was perfect before...

      The issues i have is with my submit varables... Here is the code in question.. worked fine in php4 but not in php5... why?

      if ("changeViewable" == $_POST["submit"]) {

      that particular line... if you need me to post more code surrounding it... i can do so if needed...

      In what way does it not work? I see nothing about that line of code that should be affected in any way by the change in PHP version.

      dagon;10917647 wrote:

      shouldn't that be

      if ($_POST["submit"]== "changeViewable" ) { 
      

      The order should not matter when doing such a comparison. In fact, many recommend having the literal value first like that, as you'll then get a parse error if you accidentally type "=" instead of "==".

        silly me, old habits die hard.

          This is the error i am getting... again the code worked perfect before moving to the new server..

          Notice: Undefined index: submit in /var/www/vhosts/gypsypureheart.com/httpdocs/prayer.php on line 110

          any idea what that could be from... possible something that needs to be switched on in php5?

            i bet your php.ini has changed, previously you suppressed the notices

              dagon;10917660 wrote:

              i bet your php.ini has changed, previously you suppressed the notices

              is that someone on the PHP side... or my coding is wrong?

                It's not that it's wrong, per sé, just that it could be improved.

                It's best to check that a given array index (especially with incoming data) exists first before you use it. For example, code like this:

                if($_POST['submit']) {

                should be more like this:

                if(isset($_POST['submit'])) {

                In your case, you could use [man]isset/man or [man]empty/man to check that the given array index exists before you attempt to compare its value to anything.

                  bradgrafelman;10917662 wrote:

                  It's not that it's wrong, per sé, just that it could be improved.

                  It's best to check that a given array index (especially with incoming data) exists first before you use it. For example, code like this:

                  if($_POST['submit']) {

                  should be more like this:

                  if(isset($_POST['submit'])) {

                  In your case, you could use [man]isset/man or [man]empty/man to check that the given array index exists before you attempt to compare its value to anything.

                  I did as you said... and man i have a few sites that are all coded the same... when i do what you said... i cant seem to use the }else{ as far as forms go... I know my coding is a bit sloppy but it worked... Is there a way to switch something off in the php.ini section that someone said could be an issue... So i wouldnt need to redo all my coding?

                    You could always stop PHP from displaying/logging any E_NOTICE level error messages; just add "& ~E_NOTICE" to your current error_reporting value (e.g. "E_ALL & ~E_NOTICE").

                      Write a Reply...