Highlighted

PHP & Doctype Are Red in Dreamweaver and Won't Validate

New Here ,
Sep 02, 2018

Copy link to clipboard

Copied

I am running Dreamweaver CC 2018 on Win 10 Pro, and ever since I pasted in some php code I get a red doctype <!doctype html> (HTML5 Tag), also a red opening <?php and red ?> closing tag in spite of where I open and close a php tag in the document. No matter how many php tags I type in with opening and closing php tags they are still all red, and they are also giving a validation error through DW's validation File > Validate >  Current Document (W3C). Here's my code just in case it is needed:

<?php

  // capture the data entered into the form by user

 

  // variables created to capture the form data

  $rate = 0;

  $hours = 0;

 

  // variables created

  $overtime = 0;

  $regularTime = 0;

  $regularTotal = 0;

  $overtimeTotal = 0;

 

  // conditional statement that calculates the user's amount of paycheck

  if ( $hours > 40 ) {

  $overtime = $hours;

$regularTime = 40;

$overtimetotal = $hoursWorked * $rate;

  }

  // statments that execute the calculation for the user's paycheck that the regular hours are worked

  else {

  $regularTime = 40;

$overtime = $hours - $regularTime;

$regularTime = $hours * $rate;

  }

?>

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Paycheck Calculator Results</title>

<link href="assets/bootstrap.min.css" rel="stylesheet" type="text/css">

<style>

body {

margin-top:50px;

overflow:scroll;

}

</style>

</head>

<body>

<div class="row">

<div class="col-md-4 col-md-offset-4">

<p><strong>Reported Hourly Rate :</strong><?php echo $rate ?>  </p>

<p><strong>Total Hours Worked:</strong>  </p>

<p>=============================================================</p>

<p><strong>Regular Hours Worked:</strong>  earns $ </p>

<p><strong>Overtime Hours Worked:</strong> earns $ </p>

<p>=============================================================</p>

<p><strong>Gross Paycheck Earned:</strong> $ </p>

</div>

</div>

</body>

</html>

Views

366

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

PHP & Doctype Are Red in Dreamweaver and Won't Validate

New Here ,
Sep 02, 2018

Copy link to clipboard

Copied

I am running Dreamweaver CC 2018 on Win 10 Pro, and ever since I pasted in some php code I get a red doctype <!doctype html> (HTML5 Tag), also a red opening <?php and red ?> closing tag in spite of where I open and close a php tag in the document. No matter how many php tags I type in with opening and closing php tags they are still all red, and they are also giving a validation error through DW's validation File > Validate >  Current Document (W3C). Here's my code just in case it is needed:

<?php

  // capture the data entered into the form by user

 

  // variables created to capture the form data

  $rate = 0;

  $hours = 0;

 

  // variables created

  $overtime = 0;

  $regularTime = 0;

  $regularTotal = 0;

  $overtimeTotal = 0;

 

  // conditional statement that calculates the user's amount of paycheck

  if ( $hours > 40 ) {

  $overtime = $hours;

$regularTime = 40;

$overtimetotal = $hoursWorked * $rate;

  }

  // statments that execute the calculation for the user's paycheck that the regular hours are worked

  else {

  $regularTime = 40;

$overtime = $hours - $regularTime;

$regularTime = $hours * $rate;

  }

?>

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>Paycheck Calculator Results</title>

<link href="assets/bootstrap.min.css" rel="stylesheet" type="text/css">

<style>

body {

margin-top:50px;

overflow:scroll;

}

</style>

</head>

<body>

<div class="row">

<div class="col-md-4 col-md-offset-4">

<p><strong>Reported Hourly Rate :</strong><?php echo $rate ?>  </p>

<p><strong>Total Hours Worked:</strong>  </p>

<p>=============================================================</p>

<p><strong>Regular Hours Worked:</strong>  earns $ </p>

<p><strong>Overtime Hours Worked:</strong> earns $ </p>

<p>=============================================================</p>

<p><strong>Gross Paycheck Earned:</strong> $ </p>

</div>

</div>

</body>

</html>

Views

367

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 02, 2018 0
LEGEND ,
Sep 02, 2018

Copy link to clipboard

Copied

W3c validation wont pass raw php. You will have to open the page in a browser so the php can be parsed and then run it through the validator.

Do you have a local testing server set up to run your php?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 02, 2018 1
kim4fsu LATEST
New Here ,
Sep 02, 2018

Copy link to clipboard

Copied

I verified that my local server was still running and it was. But I didn't validate the code with the page opened up the browser.

So, I did open up the browser and validated it as a live document and it did validate most of the code, except for some errors that I might have made.

Thank you guys!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 02, 2018 0
Adobe Community Professional ,
Sep 02, 2018

Copy link to clipboard

Copied

Is your document a PHP file?

Go to View > Live Code.

Then Validate > Live Document.

Nancy O'Shea, ACP
Alt-Web Design & Publishing

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 02, 2018 1