Hello im having an exam next week and this is what it will cover. all i ask is f
ID: 670646 • Letter: H
Question
Hello im having an exam next week and this is what it will cover. all i ask is for a few examples or explaining what it is and how to do it. Make sure to cover all 12 points. thanks !!!
-1Send PHP code to browser
-2Comments
-3Using variables (integer, Boolean and strings)
-4Perform arithmetic
-5Use constants
-6Choosing method get or post
-7Use simple IF statement
-8Validating data
-9Displaying and handle form in same script
-10Sticky form
-11Adding css, header and footer as “includes” (separate file)
-12Be able to add simple PHP link to HTML code (PHP is separate file)
Explanation / Answer
<html>
<body>
<h1>Welcome to my home page!</h1> <!-- welcome title of Page-->
<p>Some text.</p>
<p>Some more text.</p>
<?php include 'footer.php';
if( $_GET["name"] || $_GET["age"] )
{
echo "Welcome ". $_GET['name']. "<br />";
echo "You are ". $_GET['age']. " years old.";
exit();
}
$txt = "W3Schools.com";
echo "I love " . $txt . "!";
$x = 5;
$y = 10.5;
$foo=True;
echo $x+10 ;
if ($x < 20) {
echo "Have a good day!";
}
header('Location: http://www.example.com/');
exit;
?>
<form action="<?php $_PHP_SELF ?>" method="GET">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.