I am going to try something new. I am a programmer, and I like to people out as much as I can. When I found a problem today, I thought I wonder if anyone else has has this problem, and when I Googled it, nothing came up. I am not going to star blogging about things that I have found and that should work but doesn’t.
In this issue of Programming Oddities I am going to be discussing disabling a submit button through way of Javascript and the effect that has on PHP. First why would I disable a submit button? Simple, I didn’t want people to click it again after the initial click. The problem with that is when it went from the page with the form to the response page, the submit button wasn’t being read with an isset PHP function.
The reason that I am guessing this is happening is that when it goes to disabled, it is, the browser is seeing it as not being part of the form, hence when it is sent to PHP, it isn’t there. The solution that I did for this, and you are welcome to post your own responses is that I made a hidden element and called it something futile and unique. This way if it goes to that page and sees that this post data is set then it will continue on.
You could have done it anyway, seeing if an already existing element was there, but I did it this way because depending on the variables set it would have different elements each time, and only the submit button would be constant across all the these forms, so I had to make something else that was a constant.