Connecting Tech Pros Worldwide Forums | Help | Site Map

undefined index error

Newbie
 
Join Date: Sep 2007
Posts: 15
#1: Oct 17 '07
I keep getting the undefined index error on the bottom two rows of my code simparent and equtype - the other two work fine yet there is no difference in my code. equtypeid is even from the same table as the top two

Expand|Select|Wrap|Line Numbers
  1. $equid=$HTTP_POST_VARS['equid'];
  2. $fromuserid=$HTTP_POST_VARS['fromuserid'];
  3. $simparent=$HTTP_POST_VARS['simparentid'];
  4. $equtype=$HTTP_POST_VARS['equtypeid'];
  5.  
these are then used in an if statement
Expand|Select|Wrap|Line Numbers
  1. if ($simparent == !'Null')
  2. {
  3.     if($equtype == '8')
  4.     {
  5.          $simins = "UPDATE itsiminfo SET simparentid=NULL WHERE itsiminfo.equid='$equid'";
  6.          echo $simins;
  7.         //$resultsimins = mysql_query($simins);                     // Removes link between sim card and mobile/3G - only from SIM though not via mobile or 3G
  8.     }
  9.  
  10.     if($equtype == '7' || '4')
  11.     {
  12.         $simins2 = "UPDATE itsiminfo SET simparentid=NULL WHERE simparentid='$equid'";
  13.         $resultsimins2 = mysql_query($simins2);                 //Removes link between Mobile/3g and sim - from through mobile or 3g
  14.     }
  15. }
  16.  


anyone help??

ak1dnar's Avatar
Moderator
 
Join Date: Jan 2007
Location: Colombo
Posts: 1,440
#2: Oct 17 '07

re: undefined index error


First you should arrange your IF blocks in a propper way. I have some doubts with your conditions:
could you please take a look at on this.

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $simparent = 'Null'; // change this and check
  3. $equtype = '4'; // change this and check
  4.  
  5. if($simparent != 'Null'){
  6. echo 'match found $simparent';
  7. }
  8.  
  9. echo '<br>';
  10.  
  11. if(($equtype == '7') || ($equtype == '4')){
  12. echo 'match found $equtype';
  13. }
  14. ?>
  15.  
Reply