Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
Course Queries Syllabus Queries 2 years ago
Posted on 16 Aug 2022, this text provides information on Syllabus Queries related to Course Queries. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Turn Your Knowledge into Earnings.
A new problem has arisen for me as I tried to run my script on a different PHP Server.
ON my old server the following code appears to work fine - even when no s parameter is declared.
s
php if ($_GET['s'] == 'jwshxnsyllabus') echo "<body onload=\"loadSyllabi('syllabus', '../syllabi/jwshxnporsyllabus.xml', '../bibliographies/jwshxnbibliography_')\">"; if ($_GET['s'] == 'aquinas') echo "<body onload=\"loadSyllabi('syllabus', '../syllabi/AquinasSyllabus.xml')\">"; if ($_GET['s'] == 'POP2') echo "<body onload=\"loadSyllabi('POP2')\">"; elseif ($_GET['s'] == null) echo "<body>" ?>
But now, on a my local server on my local machine (XAMPP - Apache) I get the following error when no value for s is defined.
Notice: Undes://forum.tuteehub.com/tag/fine">fined index: s in C:\xampp\htdocs\teaching\index.php on line 43 Notice: Undes://forum.tuteehub.com/tag/fine">fined index: s in C:\xampp\htdocs\teaching\index.php on line 45 Notice: Undes://forum.tuteehub.com/tag/fine">fined index: s in C:\xampp\htdocs\teaching\index.php on line 47 Notice: Undes://forum.tuteehub.com/tag/fine">fined index: s in C:\xampp\htdocs\teaching\index.php on line 49
What I want to happen for the script to call certain javascript functions if a value is declared for s, but if nothing is declared i would like the page to load normally.
Can you help me?
Error reporting will have not included notices on the previous server which is why you haven't seen the errors.
You should be checking whether the index s actually exists in the $_GET array before attempting to use it.
$_GET
Something like this would be suffice:
if (isset($_GET['s'])) { if ($_GET['s'] == 'jwshxnsyllabus') echo ""; else if ($_GET['s'] == 'aquinas') echo ""; else if ($_GET['s'] == 'POP2') echo ""; } else { echo ""; }
It may be beneficial (if you plan on adding more cases) to use a switch statement to make your code more readable.
switch
switch ((isset($_GET['s']) ? $_GET['s'] : '')) { case 'jwshxnsyllabus': echo ""; break; case 'aquinas': echo ""; break; case 'POP2': echo ""; break; default: echo ""; break; }
EDIT: BTW, the first set of code I wrote mimics what yours is meant to do in it's entirety. Is the expected outcome of an unexpected value in ?s= meant to output no tag or was this an oversight? Note that the switch will fix this by always defaulting to .
?s=
No matter what stage you're at in your education or career, TuteeHub will help you reach the next level that you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice sessions to improve your knowledge and scores.
Course Queries 4 Answers
Course Queries 5 Answers
Course Queries 1 Answers
Course Queries 3 Answers
Ready to take your education and career to the next level? Register today and join our growing community of learners and professionals.