Here is my code:
<html>
<head>
<title>Vowel Checker</title>
</head>
<body>
<h1>Is It A Vowel?</h1>
<form action="Vowels.php" method="post">
<p>Your Letter:</p><input type="text" name="letter">
<input type="submit">
</form>
<?php
$l = $_POST['letter'];
$l = strtolower($l);
if ($l != ""){
switch ($l) {
case "a":
case "e":
case "i":
case "o":
case "u":
echo '<h1 style="color: green;">Your letter is a vowel</h1>';
break;
case "y":
echo '<h1 style="color: orange;">Your letter is sometimes a vowel</h1>';
break;
default:
echo '<h1 style="color: red;">Your letter is not a vowel</h1>';
break;
}
}
?>
</body>
</html>
If you use http://www.compileonline.com/execute_php_online.php and set $l equal to a letter (since my form submission doesn't work with online compilers) to test it out, it works properly. But I've tired JSfiddle, WAMP, and XAMPP, and it hasn't worked. I made the code on a mac using sublime text and MAMP.
This is how the program runs from WAMP/XAMPP in Google Chrome (I've also tried Firefox and IE):
https://i.sstatic.net/zzPHh.png
And if you look in inspect element, you see it has added a comment in the opening php tag:
https://i.sstatic.net/fENC7.png
I find this very strange it this error is impeding my school work =[ so id really love some help.
thank!!!
localhost/index.phpor127.0.0.1/index.php(which is the loopback IP address)