Steps to create your first PHP file
- Open your favorite text editor (Notepad++, Visual Studio, BBedit, etc.)
- Log in to your bscacad3.buffalostate.edu account
- Change directory to:
public_html
- If yu have a
cis475 sub-directory (folder) then change into that folder
- Create a new file:
index.php
- Copy the code from your
index.html file into your new index.php file
- Create a new file:
vars.php
- Open
vars.php in your editor
- Add code to start PHP: <?php
- Add PHP variables: $name = "your-name"; etc.
- Close PHP:
?>
- Open index.php in your editor
- After the
<!doctype HTML> tag, add PHP code to include your vars.php file:
<?php require_once("vars.php"); ?>
- Add code to use the PHP variables after the
<head> tag:
<meta name="author" content="<?php echo($name); ?>">
Back