简体   繁体   English

html / php代码验证错误

[英]html / php code validation error

I keep getting errors while trying to validate this code. 尝试验证此代码时,我不断收到错误消息。

Error message examples: 错误消息示例:

e.g. 1 - Line 152, Column 42: Unescaped '<' not allowed in attributes values  …>
<input type="text" name="Name" value="<?php echo htmlspecialchars($Name); ?>"…

e.g. 2 - Line 152, Column 42: attributes construct error  …>
<input type="text" name="Name" value="<?php echo htmlspecialchars($Name); ?>"…


e.g. 3 - Line 152, Column 42: Couldn't find end of Start Tag input line 152  …>
<input type="text" name="Name" value="<?php echo htmlspecialchars($Name); ?>"…

The same errors occur for any lines that contains the line eg < php echo htmlspecialchars($...) 对于包含该行的任何行,也会发生相同的错误,例如<php echo htmlspecialchars($ ...)

Please let me know what I am doing wrong. 请让我知道我在做什么错。

<!-- Form-->
<form name="editcontact" method="post" action=""> 

<table border="1" cellpadding="2">
<caption>Edit Contact</caption>

<!--ID Input-->
<tr><td><?php if ($ContactID != '') { ?>
<input type="hidden" name="ContactID" value="<?php echo htmlspecialchars($ContactID); ?>" />
<?php } ?></td></tr>



<!--Name Input-->
<tr>
<td><label for="Name">Name</label></td>
<td><input type="text" name="Name" value="<?php echo htmlspecialchars($Name); ?>" size="30" maxlength="50" tabindex="1"/></td>
</tr>

<!-- Address Input-->
<tr>
<td><label for="Address">Address</label></td>
<td><textarea name="Address" cols="45" rows="5" tabindex="2"><?php echo htmlspecialchars($Address); ?> </textarea></td>
</tr>

<!--Phone Input-->
<tr>
<td><label for="Phone">Phone</label></td>
<td><input type="text" name="Phone" value="<?php echo htmlspecialchars($Phone); ?>" size="20" maxlength="20" tabindex="3" /> </td>
</tr>

<!--Mobile Input-->
<tr>
<td><label for="Mobile">Mobile</label></td>
<td><input type="text" name="Mobile" value="<?php echo htmlspecialchars($Mobile); ?>"  size="20" maxlength="20" tabindex="4" /> </td>
</tr>

<!--Email Input-->
<tr>
<td><label for="Email">Email</label></td>
<td><input type="text" name="Email" value= "<?php echo htmlspecialchars($Email); ?>" size="30" maxlength="50" tabindex="5" /></td>
</tr>

<!--Submit Button-->
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit" value="Submit" onclick="return validateForm()" tabindex="6"/>      
</td>
</tr>

</table>
</form>

Run the PHP and validate the HTML output. 运行PHP并验证HTML输出。 Don't try to validate PHP as if it was HTML. 不要试图像将PHP验证为HTML一样进行验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM