I have a html form which has 2 textbox and a text area. I am fetching the data from the form using a php code to display it on another page.
html form code:
<html>
<form name="addsg" method="POST" action="validate.php">
<div class="label">name</div>
<div class="response"><span><textarea class="textarea" name="name"></textarea></span></div>
<div class="label">age</div>
<div class="response"><span><input class="textbox" name="age" type="text" size="5" maxlength="5" value="" /></span></div>
<div class="label">place</div>
<div class="response"><span><input class="textbox" name="place" type="text" value="" /></span></div>
<div class="submit_section button">
<input id="generate" type="submit" name="script" value="generate" />
</div>
</form>
</html>
PHP code:
<?php
if (!empty($_POST['name'])
&& !empty($_POST['age'])
&& !empty($_POST['place']))
{
echo '<textarea name="textarea" id="textarea" cols="100" rows="5" readonly>';
echo "{$_POST['name']},{$_POST['age']} years old, from {$_POST['place']}";
echo '</textarea>';
}
?>
If I put only one name in name text area column, I will get output like this
anoop,26 years old, from IN
But if I put more than one name in the name column(with same age and place), output showing like this
anoop
Tom,26 years old, from IN
Age and place are showing only for one name, not for all. I would like to get output like this
anoop,26 years old, from IN
Tom,26 years old, from IN
any suggestions ?