validate arrays

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kabucek
Forum Commoner
Posts: 50
Joined: Thu Sep 04, 2008 2:20 pm

validate arrays

Post by kabucek »

ok now I got this to work with arrays
but I don't know how to setup in such way,
when first array is ok, it goes to the next one.


 

Code: Select all

// I have   2 arrays and want them to do:
//   - if one is complete go to next:
 
 
 
 
// array 1  \\
 
 
 
        if ($checkMemberArray)
 
 
                            {
 
 
        
                                
                                 $cemailAdr=strtolower($checkMemberArray['emailAdr']);
            
 
                         $memailAdr=strtolower($memberDataArray['emailAdr']);
                                
 
 
 
                            if ($cemailAdr!=$mcemailAdr )
                            
                            
                                {
 
 
 
 
 
                                        $command="sendAccountMail"; $destPage=$PHP_SELF; $label="here";
 
                                            $quote="\"";
 
                                            $clickString="onClick=".$quote."document.$formName1.operation.value='$command'; document.$formName1.action='$destPage'".$quote;
 
                                            $hrefString="href='javascript:submitRoutine($quote$command$quote, $quote$formName1$quote)'";
 
                                            if (!$label) { $label=$command;}
 
                                            $$command="<A $hrefString $clickString>$label</A>";
 
                                        $errorArray['emailAdr']="Email Already registered";
 
                                        $processMsg.="
 
                                            <DIV class=processMsgError>
 
                                                .<P>
                                                            Our records shows that this email has been registered for this event <P>
                                                            Please provide different email address
 
                                                </DIV>
 
                                            ";
 
                                        }
 
 
  //end of array 1  \\
 
 
 
  // array 1  \\
 
 
                if ($checkMemberArray)
 
                            {
 
                                $cFirst=strtolower($checkMemberArray['first']);
 
                                $cLast=strtolower($checkMemberArray['last']);
 
                                $mFirst=strtolower($memberDataArray['first']);
 
                                $mLast=strtolower($memberDataArray['last']);
 
                                if ($cFirst!=$mFirst or $cLast!=$mLast)
 
                                    {
 
                                        $command="sendAccountMail"; $destPage=$PHP_SELF; $label="here";
 
                                            $quote="\"";
 
                                            $clickString="onClick=".$quote."document.$formName1.operation.value='$command'; document.$formName1.action='$destPage'".$quote;
 
                                            $hrefString="href='javascript&#058;submitRoutine($quote$command$quote, $quote$formName1$quote)'";
 
                                            if (!$label) { $label=$command;}
 
                                            $$command="<A $hrefString $clickString>$label</A>";
 
                                        $errorArray['emailAdr']="Mismatch email and name";
 
                                        $processMsg.="
 
                                            <DIV class=processMsgError>
 
                                            Email doesn't match our records. It has been registered already with different First & Last Name<P>
 
                                           There needs to be different f.name and l.name for each of the registrants
 
                                                
 
                                                </DIV>
 
                                            ";
 
                                        }
 
                                    else
 
                                        {
 
                                            $memberDataArray['first']=$checkMemberArray['first'];
 
                                            $memberDataArray['last']=$checkMemberArray['last'];
 
                                            }
 
                                }
 
                        }
 
 
 
 
    //end of array 2  \\
 
 
 
 
 
 
 
 
 
 
?>
Last edited by kabucek on Wed Nov 19, 2008 1:35 pm, edited 4 times in total.
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: validate arrays

Post by andyhoneycutt »

Please preview your posts =] I can't make heads or tails of what you have there, if you clean it up and repost I'll take a look and see if I can be of some help.
kabucek
Forum Commoner
Posts: 50
Joined: Thu Sep 04, 2008 2:20 pm

Re: validate arrays

Post by kabucek »

sorry,

please check now.


Thanks !!


andyhoneycutt wrote:Please preview your posts =] I can't make heads or tails of what you have there, if you clean it up and repost I'll take a look and see if I can be of some help.
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: validate arrays

Post by andyhoneycutt »

I took another look and am only marginally more aware of what you're trying to do with this code. It would be very helpful if you could include some idea of what you're trying to accomplish. Pretend I don't know PHP when you explain what you're trying to do with this code.

Thanks,
Andy.
kabucek
Forum Commoner
Posts: 50
Joined: Thu Sep 04, 2008 2:20 pm

Re: validate arrays

Post by kabucek »

no worries.
I got myself.


I wanted to check array1 ( if email is registered then display error message)
( if not then go next).

I got it :)


Thanks
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: validate arrays

Post by andyhoneycutt »

Good deal.
Post Reply