0

I am following the steps in the book PHP for the Web, 4th edition. I am using Dreamweaver for my IDE. The author is using XHTML where I am using HTML5. I followied exactly what he is doing but when sending it to the server I get this error: Parse error: syntax error, unexpected token "print" in C:\xampp\htdocs\mysite\variables.php on line 14. Here is the code:

<?php // Script 2.3 - variables.php
$street = "100 Main Street"
$city = "State College";
$state = "PA";
$zip = 16801
print "<p>The address is:<br/>$street <br/>$city $state $zip</p>";
?>

Line 14 is the print function line. I've tried placing the quotations elsewhere, I've tried following the W3Schools tutorial and get this error still. What is the problem?

Jenn Ross
  • 1
  • 2
  • What PHP sees is `$zip = 16801 print …`. No separator between statements. Use a real IDE, not Dreamweaver. – mario Jul 03 '21 at 23:49
  • So switch to a different IDE and run the same code? – Jenn Ross Jul 03 '21 at 23:57
  • I tried adding the semi-colon to the end of $zip= 16801 but received the same error along with another error about the semi-colon. Still confused here. – Jenn Ross Jul 03 '21 at 23:58
  • It's not the only missing semicolon. – mario Jul 04 '21 at 00:00
  • @mario Thank you for pointing this out. I feel a little embarrassed because I have tried everything and all it was is a missing semi-colon, lol! Thank you! – Jenn Ross Jul 04 '21 at 00:34

0 Answers0