Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript input saving and listed on the website

kysminam

New Coder
<textarea rows="5" cols="30" id="txtArea"></textarea>
<input type="button" value="Click here" onclick="getText()" />

function getText() {
var str = document.getElementById("txtArea");
alert(str.value + " i did it");
}

I can see how html , css, javascript works but I would like to know how to save the user input on my website and listed like I am writing this post and saved in the list.

thank you
 
Everything saved on a site is with a database and a language to communicate with it. Your host should have a couple of DBs for you to use. I always choose MySQL. Once done the server side language is chosen. (some DBs don't/can't use all languages. ) I use PHP.

JavaScript has a special method of sending info to your server - the PHP program that will store things in the DB. The method is called Ajax. This can provide a two way street and the PHP can tell the user that things went well or that there is an error.
Simply use POST as the method and save the set up as a snippet in your coder. https://www.w3schools.com/js/js_ajax_intro.asp
 
Back
Top Bottom