Output text from textbox directly to html page?

How can you output text from a textbox directly to an html page where it will be stored permanently?

The intent of the question is that I would like to implement a comment script for a site like this: ommmm.de/modelle_sticky.htm Every time a team member encounters one of the Comments - Submit buttons, I would so all that was entered in the text box below, will immediately update in the space above. (I used to think about php-mysql, but I would also like to know the easiest way to use the same html file that comments contain as flat file storage).

EDIT: It just seems strange to me that there doesn't seem to be one very simple solution where you can type something into a textbox, click a button and immediately paste it into html on the same page.

Thanks for the article on how to insert data into a database table. But then what would be the best way to get the data? Make a selection * on every column in every table every time the page is reloaded? This is true?

0


a source to share


3 answers


You will need to save the data to the server storing the web page. Or:

  • By writing it into the HTML file itself, or
  • Saving in the database

I think this is a pretty big question to fully answer here, so I think we need more information from you.

EDIT:



Again, this is a pretty big subject, I suggest creating a database table to store comments and then creating a PHP form (or whatever language you are comfortable with) that submits the information to the database.

You have another script that reads from the database to display the current comments.

I don't want to just embed in any PHP comment tool or guestbook tool because I have no idea how well done it is and how easy it is for you to implement. I also don't know your programming level.

So I'm going to point you to this W3Schools article on inserting data into a database. BE MEANING though this example is not safe for live streaming on the internet.

+2


a source


if i am not mistaken, you can use javascript to restore part of the comment and at the same time call your webservice via javascript, you can easily find tutorials for this. Hope that works ...



+1


a source


You need to use the AJAX sub-side logic for this. In general, let's say you choose PHP as your server side script language, you need to write some script that can take a text parameter and store it on disk and then do, and the AJAX is called there, you pass the text from the text field (using POST) to script.

EDIT: JavaScript for security reasons does not allow any kind of disk access (other than cookies), especially on the server. I just don't understand why you are so negative about the proposed solution. In short, it is a very simple task, but there is some work behind it. Therefore, every time you reload the page, you will need to re-select the data from the DB table and generate the HTML code in the same way as you would need to re-read the data from the HTML file that exists on the server that was updated. Do you want to improve it? Implement caching. There is an easy way (say with jquery) to just insert the new entered text inside an already existing DOM structure, but it won't be persistent anywhere after you have to reload the page. So don't try to find the easiest waythere it is impossible.

0


a source







All Articles