Question:

User submitted Content on My website?

by Guest57693  |  earlier

0 LIKES UnLike

I want to make a website where people can post embed html, and the post then can be viewed on the same page. How do i go about doing this?

 Tags:

   Report

2 ANSWERS


  1. If you want to do this without reloading the page, you need javascript.

    <textarea cols=40 rows=6 onKeyUp=' document.getElementById( "preview" ).innerHTML = this.value; '> </textarea>

    <div id='preview'></div>

    Every time you press a key, the preview updates.

    Actually uploading that to your site and storing it is a whole other issue.  That requires a scripting language like PHP.

    If you do need help uploading, just ask.


  2. Sorry, jdorndog, this won't work!

    - Once your textarea is up, anything the user type IS visible: it is like a input field on a form.

    - The use of onKeyUp is a terrible approach: you run the function at each keypress, consuming processing power for nothing and rendering the typing slow and irritating. (like YA! question field, counting remainting characters at each keypress!!!  Who in is right mind needs that???)

    - Use "onBlur" instead.

    - Whatever you do, your JS does not change anything: it just "stores" the text in textarea (which is already there!)

    - Finally, you do not POST anything!  The textarea must be in a form, and that form MUST be posted to be saved.

    - If you want, you could use <form><div><textarea onblur="theform.submit()"> but your form must be submitted to something!

    Finally, the word "embedded" is incorrectly used in this case: it is not a piece of code that is "embedded" into an HTML, it is just a textarea that receives an input...

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.