I am a little new to the inner workings of inputs and form actions. But I've been studying tirelessly trying to figure this out, maybe Im not researching the right way, but I am amazed at how little information there is on how to do a very common thing that I know is done all day everyday, with saving inputs like usernames and passwords. But again I want the usernames and passwords to stay visibly there once the save button is clicked on an individual input with an individual save button
So I am wanting to create several input fields on a php file webpage. These input will allow me and others working with me to store things like usernames, passwords, and other notes of sort.
let's start with this code.
<section>
<div id="#" class="input-notediting">
<input type="text" value="" id="first-input" class="input-notediting">
</div>
<button class="save-button" onclick="saveField()">
<i class="fa fa-floppy-o"></i>
</button>
</section>
1 input and 1 save button contained within section tags. And there may be more inputs contained within one section depending but..
I know many of you want to inform me of using a
<form method="post" action="">
to contain the inputs. And I'm not opposed to doing that, but I've seen other workarounds using ajax code for saving fields to a php script, to know that it may not be necessary.
I'm sorry this is all the code I essentially know how to work with at this point for my particular problem and question here.
But I'm pretty sure I need to use some jQuery to save the input data to a php file or a mySQL database table??
Basically how I want this to work is once the inputs are saved by a user clicking the save button, the value simply stays in the input field forever until another person changes the value or deletes it physically. I would also love for this to work with the click of a save button that wont refresh the page if possible or show any dialogue boxes at all or of a successful save either. Just want it clean and nice, trust that it is working and if I reload the page 2 days later the text I saved will still be there.
My research points me to many different types of solutions. Things like sort of a re - echo the contents of a mySQL table or the php file script variables into the
<input vale="<?php echo (""); ?>">
sorta maybe like this.
Other research points me to weird workarounds not all that suitable to my quest anyways, but require me to use a
<form method="post" action="">
to the php file script which again I am not opposed to doing if it works and is necessary but I would really prefer the page not to reload upon the submit action, but I tried that and then I for some reason can't get the form action to bring me back to the page I was on anyways, which stinks too, I know its done well all the time but I just don't know how to yet.
I would love for an advanced solution here. Thanks everyone.
Please please please help me out, I've got a large project to do on this and would be greatly appreciated, and always continue to learn everything I can. I am more or less an html and css expert, but dealing with forms and input functions and databases is a tiny bit new to me recently.