Whenever error occurs, I need to display the exception message in HTML page.
Basically my HTML page has a 开发者_开发问答form called "My_formG".
I need to display the exception content ( or at least a normal statement/sentence "try it again") above the form "My_formG".
For that I tried the code,
<html>
<body>
<?php
$MyexceptionOverFlow=1;
if(isset($MyexceptionOverFlow))
{
?>
<div>
<?php echo " OVER FLOW EXCEPTION....... ";?>
</div>
<?php
}
?>
<form id="My_formG">
Enter your name:
<input type="text" id="id1">
</form>
</body>
</html>
Output:
I am getting only the content of My_formG.
But I need content from both to be displayed. (I think the content of the if block is getting overwritten by the form. Is it so??).
This works just fine for me:
<html>
<body>
<?php
$MyexceptionOverFlow = 1;
if($MyexceptionOverFlow){ ?>
<div>
<?php echo " OVER FLOW EXCEPTION....... "; ?>
</div>
<?php } ?>
<form id="My_formG">
Enter your name:
<input type="text" id="id1">
</form>
</body>
</html>
精彩评论