Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer and show your work. Thumbs up guaranteed. Please add comments so I

ID: 3705265 • Letter: P

Question

Please answer and show your work. Thumbs up guaranteed.

Please add comments so I can understand how you wrote the code. Please keep the code fairly simple as well for these are introductory questions with the basics of PHP taught only.

Thank you!

Given the following URI (Uniform Resource Identifier): http://www.site.com/index.php?age 22&name-; Obi+Wan+Kenobi&number; 5435432156 Answer the following short questions: 1- What is a query string and what purpose does it serve in server-side programming? 2- Is a query string characteristic of a GET or POST request method? 3- Which part of the URL is considered the query string? 4- How many different data parameters are being passed? Create a single .php page (name it index.php) that, when passed the above query string as part of the URL processes the data using PHP and outputs it onto the screen in a nicely formatted table that resembles (CSS should be used in order to add some style): Name Age Phone Number Display phone number from query String Display Name data from query String Display Age data from query String The text in italics must be replaced with the appropriate values retrieved from the URI query string. If the query string is omitted from the URL, the above table should be replaced with the message: "No query string data found".

Explanation / Answer

1) A query string is a string used to query specific information from the server by passing parameters into the URL.

2) GET request method because it fetches the information from the database.

3) The part after the '?' character is considered as a query string..

4) 3 different parameters: Age, Name and Number are being passed.

Code:

index.php:

<!DOCTYPE html>

<html>

<head>

<link rel="stylesheet" href="styles.css">

<title>Page Title</title>

</head>

<body>

<?php

echo "<table>" ; //Table Tag   

echo "<tr>"; //Row

echo "<th>Name</th>"; //Name Heading

echo "<td>".$_GET['name']."</td>"; //GET name parameter

echo "<th>Age</th>";

echo "<td>".$_GET['age']."</td>"; //GET age parameter

echo "<th>Number</th>";

echo "<td>".$_GET['number']."</td>"; //Get number parameter

echo "</tr>";

echo "</table>";

?>

</body>

</html>

styles.css: