Author Topic: Problems with If & Ifelse  (Read 201 times)

mhadfield

  • New Member
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Problems with If & Ifelse
« on: July 04, 2012, 11:42:04 AM »
I'm having a problem with if and else at the moment, basically there are three outcomes of the form; eligable for group a , eligable for group b, not eligeble. the eligibility fo groups is based on one question but I can't get else if for work!!

any Ideas?

PHP Code: [Select]
  
	
	
	
 
	
	
	
	
 
 if ((
$a == "Yes") && ($b == "No")  && ($c == "No") && ($d  == "Yes") && ($e == "No") && ($f == "No") && ($g  == "Yes") && ($h == "Yes") && ($i == "Yes") && ($j == "No"))
	
	
 
	
	
	
   
	
	
	
	
	
	
 
print (
" <center><h3> Case is Eligible - Assign to Workshop Group</h3></center>"); 
	
	
	
	
	
	
	
	
	
	
	
	
  
  
$group "Case is Eligible - Assign to Workshop Group ";

	
elseif
	
(
$a== "Yes") && ($b == "No")  && ($c == "No") && ($d  == "Yes") && ($e == "No") && ($f == "No") && ($g  == "Yes") && ($h== "Yes") && ($i == "No") && ($j == "No")) 
	
	
	
	
	
print (
" <center><h3>Case is Eligible – Assign to Control Group </h3></center>"); 
	
	
	
	
	
	
	
	
	
	
	
	
	
	

	
	
	
  
	
	
	
	
	
$group "Case is Eligible – Assign to Control Group";
	


	
	
	
} else {
	
	
	
	
	
	
	
	
	
	
	

	
	
	
  
	
	
print (
" <center><h3>Case is NOT Eligible </h3></center>"); 
	
	
	
	
	
	
	
$group "Case is NOT Eligible "
	
	
	
	

	
	
	
	
	
	
	
 }
	
   
	
	

beardavid

  • New Member
  • *
  • Posts: 8
  • Karma: 0
    • View Profile
Re: Problems with If & Ifelse
« Reply #1 on: July 04, 2012, 12:56:05 PM »
you left off the ( on the elseif in front of the a == "yes'

RaythXC

  • PHP Programmer & Web-Designer
  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 395
  • Karma: 10
  • Freelance PHP Programmer/Web-Designer
    • View Profile
    • Rayth.Info
Re: Problems with If & Ifelse
« Reply #2 on: July 04, 2012, 04:48:20 PM »
Theres no opening { for your first if statemnt but there is a closing one before the elseif
RaythXC - My Home Site
Note: most answers I give come from the php manual located at PHP.Net

mhadfield

  • New Member
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: Problems with If & Ifelse
« Reply #3 on: July 10, 2012, 09:22:58 AM »
Thanks guys!!!

ErnieAlex

  • Expert PHP Helper
  • Senior Member
  • *****
  • Posts: 1847
  • Karma: 32
    • View Profile
Re: Problems with If & Ifelse
« Reply #4 on: July 11, 2012, 09:28:14 AM »
Did that solve it?  If so, we will mark it so...  If not repost the new code...