I’m doing my first assignment for my PHP class and it seems I’m in way over my head. Last week, I was able to view a few practice .php files in my browser and they were working fine. Now only the content outside of the <?php ?> brackets is showing (the html headings and whatnot) in any file I try to open. Below is the assignment I’m working on. It’s definitely a work in progress since I haven’t been able to view anything except the headings in my browser. I have no clue if any of the php actually works. I’m on a computer running Windows 7 Enterprise, I’m using XAMPP then copying my files into my school’s FTP client.
Also, when I’m in TextPad and I click “View in Web Browser,” it opens my files up in Notepad. Last week it launched them straight into IE. What am I missing here?
Dangerous Pirates body {background-color: lightblue; color: indigo; margin-left: 50px}Dangerous Pirates
Program ID
Your Name
<?php
$pirate1 = "Cheung Po Tsai";
$pirate2 = "Bartholomew Roberts";
$pirate3 = "Anne Bonny";
define("PICTURE1", dead_men.gif);
define("PICTURE2", skull.gif);
define("PICTURE3", map.gif);
header ('content-type: image/gif');
readfile(PICTURE1);
echo "<p><h4>", $pirate1, "</h4>
One of the characters in the movie Pirates of the Caribbean: At World's End is based on Cheung Po Tsai. Cheung was mostly known because of a legend about his hidden treasure in Cheung Po Tsai Cave in Cheung Chau Island. Many tourists still visit this location trying to find hidden pirate treasure.</p>";
header ('content-type: image/gif');
readfile(PICTURE2);
echo "<p><h4>", $pirate2, "</h4>
Bartholomew Roberts was the most successful pirate the world ever knew. Rumor has it he plundered around 400 ships in his lifetime. He was born in 1682, died in 1722, and was known as Black Bart.</p>";
header ('content-type: image/gif');
readfile(PICTURE3);
echo "<p><h4>", $pirate3, "</h4>
Anne Bonny was an Irish pirate born Anne Cormac in 1697. She married pirate James Bonny when she was 16 and followed him to a pirate's hideout in New Providence. In 1720 she was on a ship when the British Navy attacked. The crew was taken to Port Royal to stand trial. Though found guilty of the crime of piracy, Anne was spared her life because she claimed to be pregnant. The fate and date of death of Anne Bonny is unknown. </p>";
?>