tapupartforpres Posted September 4, 2008 Share Posted September 4, 2008 Hello People. Quick question. I have a form in which has 8 guests that a person can invite to an event. Basically if one fills out the form for any of the guests then they are charged $45. Now if they have an affiliation with 5 of the companies that we deal with they get a $10 discount. So it will all derive from what affiliation the main register fills out. I need it to relate to 5 buttons with the values of 1 through 5. The value that is in place now is 1. But I need it to be the value of all 1 through 5 numbers. The question is do I have to write an if statement for each of the radio buttons selected. Sorry if vague, but here is a link to help. Below is the code. Thank you. http://amplify.econtempodg.com/test/guest_page1.html if($affil == "1"){ $price = $price+35; $fee = $fee + 1.5; }else{ if($affil == "0"){ $price = $price+45; $fee = $fee + 1.5; } } Link to comment https://forums.phpfreaks.com/topic/122735-solved-if-statement/ Share on other sites More sharing options...
tmbrown Posted September 4, 2008 Share Posted September 4, 2008 do a switch <?php switch($affil){ case 1 : /* Execute Code */ ; break ; case 2 : /* Execute Code */ ; break ; case 3 : /* Execute Code */ ; break ; case 4 : /* Execute Code */ ; break ; case 5 : /* Execute Code */ ; break ; } ?> where the number beside case is the value of $affil Link to comment https://forums.phpfreaks.com/topic/122735-solved-if-statement/#findComment-633816 Share on other sites More sharing options...
tapupartforpres Posted September 4, 2008 Author Share Posted September 4, 2008 I just switched the statement and used a equal to or greater. Thanks Link to comment https://forums.phpfreaks.com/topic/122735-solved-if-statement/#findComment-633962 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.