How to Insert PHP Into the Center of an HTML File
- 1). Launch your text or HTML editor and create a new file. Save the file as "index.php."
- 2). PHP code begins with "<?php" and ends with "?>." The PHP "echo" command causes a display of the associated string. Insert the following example coding into the document:
<html>
<head>
<title>Welcome</title>
</head>
<body>
<h1><?php echo 'Welcome to My Site!'; ?></h1>
</body>
</html> - 3). Save the file and transfer the page to your server using an FTP client, such as WSFTP or Dreamweaver. View your page online with a Web browser. The page will display the data "Welcome to My Site!"