html - Validation Error when printing tables with PHP
Get the solution ↓↓↓I get a validation error while printing the following table in php.
echo "<table class = '1'>";
echo "<tr><th>Fahrenheit</th><th>Celsius</th></tr>";
if (isset($_POST['submit']) && $message == '') {
for ($i = $min; $i < $max; $i += $step) {
$temp = ($i - 32) / 1.8;
$temp = round($temp, 2);
echo "<tr><td>" . $i . "</td><td>" . $temp . "</td></tr>";
}if ($i > 1) {
echo "You are viewing temperature conversion from $min to $max incrementing by $step <br><br>";
}
}echo "</table>";
The table does print and works fine, but it does not pass validation and I get the following error.
The border attribute on the table element is obsolete. Use CSS instead.
From line 48, column 13; to line 48, column 32
<table border = '1'><tr><t
Answer
Solution:
Instead of
echo "<table class = '1'>";
try to use
echo"<table class = 'table'>"; and format it using CSS.
table,td { border: 2px solid gray;
border-collapse: collapse; }
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: warning: undefined array key
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.