rcampos39
-
Posts
6 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by rcampos39
-
-
This app was created over 4 years ago and its not my code. I inhareted this app when I came into a new position with the company im working with and I just want to make it work, then I will revamp the look and feel as well.
Here are the notices that I get.
Notice: Undefined variable: semattend in /var/www/html/www4.aacrao.org/sem-ep/fees.php on line 3Notice: Undefined variable: semattend in /var/www/html/www4.aacrao.org/sem-ep/fees.php on line 17Notice: Undefined variable: semattend in /var/www/html/www4.aacrao.org/sem-ep/fees.php on line 31Notice: Undefined variable: semattend in /var/www/html/www4.aacrao.org/sem-ep/fees.php on line 45Notice: Undefined variable: total in /var/www/html/www4.aacrao.org/sem-ep/fees.php on line 61
-
I don't know where $semattend is being set. You should show the section of code where the warnings are given, warnings always give a line number and a filename.
You must always give a value to your variables. Make sure $total and $semattend are always given a value no matter what the situation is.
Your if() statement should take into account whether the registrant is a member or not. You could add a final else statement for that:
} else { $total = "<tr><td colspan="2"><p>Member not registered</p></td></tr>";}
I would recommend relearning HTML and CSS, your code looks really outdated and would be considered invalid by the W3C validator.
This app was created over 4 years ago and its not my code. I inhareted this app when I came into a new position with the company im working with and I just want to make it work, then I will revamp the look and feel as well.
-
That code looks fine. You could also use a switch() to do it, but I wouldn't be fussed about that.
What warnings are you getting?
If the registrant is not a member, the total wont show up and I get undefined variable for $total and $semattend.
-
If the registrant is not a member, the total wont show up and I get undefined variable for $total and $semattend.
-
I am fairly new to PHP and I was tasked with migrading an app that runs on php 4+ enviroment into a 5.4 enviroment and I am getting warnings becasue its very old code, but I also would lie to know if there is a better way of writing the fallowing script of php code.
It checks weather a member has attended a course and if so it charges a price if not its a different price and so on.
Any help would be very appriciated.
<?phpif ($semattend == 'MEMBER-ATTENDED') {$total = "<tr> <td height="30" align="right"><p><font color="#FF9900">*</font><font size="2">Total: </font></p></td> <td height="30" colspan="3" align="left"><font size="2"><input type="hidden" id = "amount" value="1299" name="amount" size="28">$1,299</font></td> </tr> <tr> <td colspan="3" align="left"><p>Search results indicate that you belong to a member instituion and have completed the Essentials of SEM course</p></td> </tr> <input type="hidden" id = "semstatus" value="MEMBER-ATTENDED" name=semstatus"> <input type="hidden" id = "attended" value="Attended Course" name="attended"> <input type="hidden" id = "member" value="Member" name="member">";} elseif ($semattend == 'MEMBER-NOTATTENDED') {$total = "<tr> <td height="30" align="right"><p><font color="#FF9900">*</font><font size="2">Total: </font></p></td> <td height="30" colspan="3" align="left"><font size="2"><input type="hidden" id = "amount" value="1799" name="amount" size="28">$1,799</font></td> </tr> <tr> <td colspan="3" align="left"><p>Search results indicate that you belong to a member instituion and have not completed the Essentials of SEM course</p></td> </tr> <input type="hidden" id = "semstatus" value="MEMBER-NOTATTENDED" name=semstatus"> <input type="hidden" id = "attended" value="Not Attended Course" name="attended"> <input type="hidden" id = "member" value="Member" name="member">"; } elseif ($semattend == 'NONMEMBER-ATTENDED') {$total = "<tr> <td height="30" align="right"><p><font color="#FF9900">*</font><font size="2">Total: </font></p></td> <td height="30" colspan="3" align="left"><font size="2"><input type="hidden" id = "amount" value="1599" name="amount" size="28">$1,599</font></td> </tr> <tr> <td colspan="3" align="left"><p>Search results indicate that you do not belong to a member instituion and have completed the Essentials of SEM course</p></td> </tr> <input type="hidden" id = "semstatus" value="NONMEMBER-ATTENDED" name=semstatus"> <input type="hidden" id = "attended" value="Attended Course" name="attended"> <input type="hidden" id = "member" value="Non Member" name="member">"; } elseif ($semattend == 'NONMEMBER-NOTATTENDED') {$total = "<tr> <td height="30" align="right"><p><font color="#FF9900">*</font><font size="2">Total: </font></p></td> <td height="30" colspan="3" align="left"><font size="2"><input type="hidden" id = "amount" value="2099" name="amount" size="28">$2,099</font></td> </tr> <tr> <td colspan="3" align="left"><p>Search results indicate that you do not belong to a member instituion and have not completed the Essentials of SEM course</p></td> </tr> <input type="hidden" id = "semstatus" value="NONMEMBER-NOTATTENDED" name=semstatus"> <input type="hidden" id = "attended" value="Not Attended Course" name="attended"> <input type="hidden" id = "member" value="Non Member" name="member">"; }echo $total;?>
Migrading from PHP 4+ TO 5.4+
in PHP
Posted · Edited by rcampos39
It Queries the database for the email the the registrant used, if th eemail exists they get discounted prices if it doesnt they get full price. Then $semattend uses that query result to be used in the code above. I think the queary may be wrong. this is what that looks like.