Steps to create your first PHP file

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

Back