Add list item every time i click submit

后端 未结 4 1442
温柔的废话
温柔的废话 2021-01-16 23:55

I want a script which will echo a text from a form to a div tag every time i click the submit button.

i was able to do that in no time but i want the text to still b

4条回答
  •  别那么骄傲
    2021-01-17 00:37

    thought I would chime in too. This is a simple solution that will work only in the current instance of a page.

    
    
    
    
    "; # Start the list foreach ( $text_arr as $text ) { # For each item of text that has previously been input echo "
  • ".$text."
  • "; # Print out the list item with the text in it } echo "
"; # End our list } ?>
# If the previous form submitted some text # Store it in a hidden input field to be submitted later Name:

So this will do what you want but without any storing into a database. If storing into a database is what you want to do then you might want to do some research into MySQL or some other method of permanently storing list items.

Hope mine has been of some help, I'm sure many others have popped an answer on while I have been typing this...

提交回复
热议问题