PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
But the code wouldn't ask users without javascript for confirmation... It would simply delete. (I admit that my phrasing 'will not work for ppl without javascript' wasn't good and should have been more like 'will not ask for confirmation if ppl don't have javascript enabled')
Nathaniel's code on the other hand clearly suggested another variable ($confirm) from a (separate) confirmation form...
There is no longer any dispute as to what onclick="return... does when JavaScript is on and off.
In many circumstances no confirmation will be an acceptable fallback for non-JS users especially considering it will be so much faster for those who do have JS then a server side confirmation but yes server side confirmation is the only one that will work all the time.
Considering the application would perform quite differently, potentially doing very bad things, based on my Javascript being enabled or not, I'd consider that a bug. Ole may not, but psurrena may. That is up to him/her, but it is something to be aware of and consider for sure.
Create a JavaScript Function that passes another get variable to the string that would tell the Server Script that it was confirmed by the JS (not secure). The other way would be to use the JavaScript HTTPXMLRequest(), which would be more secure.
If you use the JavaScript function and they don't have JavaScript enabled, then it would just go to the url which the server would ask if they are sure they want to delete the record.
The same thing as with the AJAX method, if JavaScript is enabled it would pop up and if confirmed send the request to the file without reloading the page. If not, then same as above.