I am working on a budgeting app using PHP HTML and a touch of JS.
I want to have an import button that can only be clicked one time by the user then it is disabled or hidden even if they refresh the page, But for a new user, it would still be available until they click it.
I have tried code like this but it is available to click again after each refresh.
<form action='/' method='POST' onsubmit='disableButton()'>
<input name='txt' type='text' required />
<button id='btn' type='submit'>Post</button>
</form>
<script>
function disableButton() {
var btn = document.getElementById('btn');
btn.disabled = true;
btn.innerText = 'Posting...'
}
</script>
Is there any way to accomplish this?