1. Create an associative array, to reflect data in the following table. Store the array in a variable     called $electives. (see pages 44 and 45 in course text)  Key Value CSIS-335 Graphical User Interface Programming SIS-336 C#.Net Programming CSIS-341 System and Network Administration CSIS-360 Linux Programming and Developmen 2. Using a foreach loop, write code that will display a hyperlink for each name in the table, e.g  CSIS-335 CSIS-336. (see sample code, get-1.php on page 237 in course text; see sample code  for-each-loop.php on page 92 in course text book). 3. Insert code to check if the key collected, using the query string, exists in the electives array. 4. Insert code that will cause the phrase “Select a course” to be displayed, if key in the query string  does not exist. Test this by entering CSIS-152 in query string. Capture the outcome with a  screenshot.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Objectives
– Demonstrate use of associative arrays
- Demonstrate knowledge of use of $_GET super global variable in data validation
- Demonstrate handling of missing data in $_GET
PHP $_GET is a PHP super global variable that can be used to collect form data after submitting an HTML 
form with method="get". The PHP $_GET super global variable can be used to collect data sent in the 
URL.
Task: You will modify given code, part-2.php, to collect a course number and display its title. For 
instance, user will click on the hyperlink CSIS152, and this will cause the corresponding title 
“Introduction to Computers and Programming I-a”, to be displayed.
1. Create an associative array, to reflect data in the following table. Store the array in a variable 
   called $electives. (see pages 44 and 45 in course text) 

Key

Value

CSIS-335

Graphical User Interface Programming

SIS-336

C#.Net Programming

CSIS-341

System and Network Administration

CSIS-360 Linux

Programming and Developmen

2. Using a foreach loop, write code that will display a hyperlink for each name in the table, e.g 
CSIS-335 CSIS-336. (see sample code, get-1.php on page 237 in course text; see sample code 
for-each-loop.php on page 92 in course text book).
3. Insert code to check if the key collected, using the query string, exists in the electives array.
4. Insert code that will cause the phrase “Select a course” to be displayed, if key in the query string 
does not exist. Test this by entering CSIS-152 in query string. Capture the outcome with a 
screenshot.

modify the given code:

<?php
$electives  = [
    
];
  = $_GET[' '] ?? '';
$valid = array_key_exists($, $electives);

if ($valid) {
    
} else {
   
}
?>

<?php foreach ($electives as $key => $value) { ?>
  <a href="step-2.php?      =<?= $key ?>"><?= $key ?></a>
<?php } ?>

<h3><?=   ?></h3>

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education