• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Sep 02, 2018 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

847

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
community guidelines
LEGEND ,
Sep 02, 2018 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?

Votes

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
community guidelines
New Here ,
Sep 02, 2018 Sep 02, 2018

Copy link to clipboard

Copied

LATEST

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!

Votes

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
community guidelines
Community Expert ,
Sep 02, 2018 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— Product User, Community Expert & Moderator
Alt-Web Design & Publishing ~ Web : Print : Graphics : Media

Votes

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
community guidelines