Last active
November 17, 2022 03:17
-
-
Save robynitp/8924077 to your computer and use it in GitHub Desktop.
Intro to PHP with HTML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>The Top Bar Title</title> | |
</head> | |
<body> | |
<p>Some information</p> | |
<!-- We're about to start PHP --> | |
<? php // We're in PHP now. | |
// assign some variables -- variables in PHP start with a dollar sign ($) | |
$user_name = "Jennifer"; | |
$user_address = "721 Broadway"; | |
// end PHP (for now) | |
?> | |
<!-- Now we're back in HTML --> | |
<h1>User Profile</h1> | |
<p><strong>Name</strong><br/> | |
<?php | |
// We're back in PHP now | |
echo $user_name; // output a variable | |
echo '</p>'; // end the paragraph tag started above | |
// Output some HTML and PHP all together | |
echo "<p><strong>Address</strong><br/>$user_address</p>"; | |
// end PHP | |
?> | |
<!-- Back in HMTL --> | |
<div id="footer"> | |
<p>Follow us on Twitter!</p> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment