javascript - PHP form processing -


i have html form has 2 textbox , text area. fetching data form using php code display on 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, {$_post['place']}";      echo '</textarea>';    }  ?> 

if put 1 name in name text area column, output this

anoop,26 years old, in 

but if put more 1 name in name column(with same age , place), output showing this

anoop tom,26 years old, in 

age , place showing 1 name, not all. output this

 anoop,26 years old, in  tom,26 years old, in 

any suggestions ?

<? $name_array = explode( "\n", $_post['name'] ); //use new line char separator ?>  <textarea name="textarea" id="textarea" cols="100" rows="5" readonly> <? foreach( $name $name_array )   echo $name.', '.$_post['age'].' years old, '.$_post['age']."<br/>\n"; ?> </textarea> 

Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -