Web Global Net Web Application & Web Development Project Center

Technical Issues => php related => Topic started by: admin on August 07, 2017, 10:33: PM



Title: 3 what if conditions for show If based on dynamic data
Post by: admin on August 07, 2017, 10:33: PM
This is a Show if based on 3 conditions of a variable.

One of the difficulties we had was echoing dynamic data into the link in this case the year

<a href=classregs_year_military.php?reunion_year='.$year.'>

So what we did was create a variable $year

<?php $year=$row_rsreunionreg['reunion_year']; ?>

Then we had no issues using it in the If statements


The first condition evaluates the @$row_rsreunionreg['use_reason']
to see if its either for Military or Family use, if neither of these conditions are true then it displays the Record Icon and its link.

The 2 and 3rd condition show what to display based on weather or not its a Military or Family use and displays the appropriate Menu icon and link

For some reason if there is any space between each condition then the icon will not display

<?php
 if (@$row_rsreunionreg['use_reason'] != "Military" AND @$row_rsreunionreg['use_reason'] != "Family"){
echo '<a href=classregs_year.php?reunion_year='.$year.'><img name="list_regs" src="a_registration_report_icon_sm.png" width="28" height="36" border="0" vspace="5" id="list_regs" alt="" />[/url]
                        

                      Registrations';
   }
   if (@$row_rsreunionreg['use_reason'] == "Military") {
      echo '<a href=classregs_year_military.php?reunion_year='.$year.'><img name="list_regs" src="a_registration_report_icon_sm.png" width="28" height="36" border="0" vspace="5" id="list_regs" alt="" />[/url]
                        

                      Registrations';
   }
if (@$row_rsreunionreg['use_reason'] == "Family") {
echo '<a href=classregs_year_family.php?reunion_year='.$year.'><img name="list_regs" src="a_registration_report_icon_sm.png" width="28" height="36" border="0" vspace="5" id="list_regs" alt="" />[/url]
                        

                      Registrations';
   }     
?>