Post multiple lines with PHP -


when presses submit button line added code:

<html> <head> </head> <body>      <form method ="post" action="" name ="formpje">          line<input type="text" name="name"><br>         <input type="submit" name="submit"><br>     </form>  <?php $post = $_post['name']; echo $post; ?> </body> </html> 

the result:

enter image description here when add new line current 1 gets changed newest one. want stay add new one. heres like:

enter image description here

try this, each time submit form place name session , print out bellow.

<?php      session_start();     if( isset( $_post[ 'submit' ] ) )     {           $_session[ 'submissions' ][] = $_post[ 'name' ];      }  ?> <form method ="post" action="" name ="formpje">     line<input type="text" name="name"><br>     <input type="submit" name="submit"><br> </form>  <?php     foreach( $_session[ 'submissions'] $line )     {         echo $line."\n";  <------ may need replace "<br>" instead of "\n" html.     } ?> 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -