Skip to content

Instantly share code, notes, and snippets.

@saaeiddev
Created October 31, 2022 19:27
Show Gist options
  • Save saaeiddev/a01589cc9a891c33f881567f64a7b3c3 to your computer and use it in GitHub Desktop.
Save saaeiddev/a01589cc9a891c33f881567f64a7b3c3 to your computer and use it in GitHub Desktop.
<?php
function get_value($param, $default = null) {
if(isset($_GET[$param])) {
$value = $_GET[$param];
} else {
$value = $default;
}
return $value;
}
/*
function get_value($param, $default = null) {
if(isset($_REQUEST[$param])) {
$value = $_REQUEST[$param];
} else {
$value = $default;
}
return $value;
}
*/
$math = get_value('math', 0);
$prog = get_value('prog', 0);
if($math) {
if($prog) {
$title = 'Math and Programming Courses';
} else {
$title = 'Math Courses';
}
} else {
if($prog) {
$title = 'Programming Courses';
} else {
$title = 'Courses';
}
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo $title; ?></title>
</head>
<body>
<h1>Recommended Courses</h1>
<?php if($math): ?>
<h2>Math Courses</h2>
<ul>
<li>General Mathematics I</li>
<li>General Mathematics II</li>
<li>Differential Equations</li>
<li>Numerical Methods</li>
<li>Engineering Mathematics</li>
<li>Discrete Mathematics</li>
</ul>
<?php endif; ?>
<?php if($prog): ?>
<h2>Programming Courses</h2>
<ul>
<li>C/C++ Programming</li>
<li>Python Programming</li>
<li>MATLAB Programming</li>
<li>Java Programming</li>
<li>C# Programming</li>
</ul>
<?php endif; ?>
<?php if(!$prog && !$math): ?>
<h3>Sorry! There is not any recommended course for you, right now.</h3>
<?php endif; ?>
<a href="request_course.php">Return to Request Form</a>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment