Hi I put a sample code I’ve done below to explain my concern. Simply the code works fine except displaying the ‘echo’ messages in a desired location on the page. when the code is executed, the echo messages appear just on the page, but I need the message to be appear in the ‘cell4’ table cell.
I tried modifying the code as {echo “Name is blank!”; return false;} on the line 30, but seems that its not a correct method as no change in the result. Can someone please tell me is there a workaround for this? Thanks for looking.
Here goes the code:
<html>
<head><title>Test</title></head>
<body>
<form method="POST" action="<?= $_SERVER['PHP_SELF'] ?>">
<table border="1">
<thead>
<tr>
<td colspan="4">User detail</td>
</tr>
</thead>
<tr>
<td id="cell1">Name:</td>
<td id="cell2"><input type="text" name="Uname"></td>
<td id="cell3"><input type="submit" name="SendNow" value="Save"></td>
<td id="cell4"></td>
</tr>
</table>
</form>
</body>
</html>
<?php
if(isset($_POST['SendNow']))
{
$nm = $_POST['Uname'];
if($nm == "")
{echo "Name is blank!"; return false;}
else
{echo "Well done!"; return false;}
}
?>
Sorry the edited code has not appeared correct in the above text. This is how I have tried modifying : {echo "<td id='cell4'>Name is blank!</td>"; return false;}
1 Answer