· Chapter 10, Part 2: HTML Encoding 1. Create a file named: HTMLencoding.php in
ID: 3551606 • Letter: #
Question
· Chapter 10, Part 2: HTML Encoding
1. Create a file named: HTMLencoding.php in your text editor.
2. create a URL using your MyFirstPage link (e.g. http://www.juliegrimes.com/jsmith/sandbox/10/MyFirstPage.php). Use characters you will need to encode. The only extra thing I'd like is a display of the characters below the actual link, using: <?php echo htmlspecialchars($url); ?>
3. NOTE: Don't bother clicking on the link in your file as it will not work since rawurlencode will convert your '/' to '%2F'.....this is why I wanted the extra echo. Just make note of the htmlentities part of the video, but it is not used in this assignment.
4. Here is a sample of what your output should look like.
http://www.server.com/jsmith%2FMyFirstPage.php?param1=This+is+a+string+with+%3C%3E¶m2=%26%23%3F%2A%5B%5D+are+bad+characters
Explanation / Answer
<html>
<head>
<title>HTML Encoding</title>
</head>
<body><br><br>
<p>
<a href="http://www.juliegrimes.com/jsmith/sandbox/10/MyFirstPage.php">
<CLICK> & Learn More! </a><br><br>
<?php
$url="<b>http://www.<i>juliegrimes</i>.com/jsmith/sandbox/10/MyFirstPage.php</b>";
echo $url."<br><br>"; // url without special characters
echo htmlspecialchars($url); // url with special characters
?>
</body>
</html>
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.