August 28, 200916 yr Never a good idea, is it? To change something that works fine...... My PHP form script (a very slightly tweaked version of Jem's script) no longer works as intended if there is nothing in the comments box. This field is not included as one of the mandatory fields (and never has been), so it should go through as it used to. Any attempt to trigger an error message (eg. "Please provide...." etc.) does nothing. It repopulates the form as normal, but the error messages are not displayed. Filling in the required fields and the message box results in a successful submission. I ruled out the points system: changing it doesn't fix the issue. There must be an error in the code somewhere, but I'm stumped, so anyone who can spot the problem has my thanks. The PHP is in the supplied attachment. example.php
August 29, 200916 yr Never a good idea, is it? To change something that works fine...... My PHP form script (a very slightly tweaked version of Jem's script) no longer works as intended if there is nothing in the comments box. This field is not included as one of the mandatory fields (and never has been), so it should go through as it used to. Any attempt to trigger an error message (eg. "Please provide...." etc.) does nothing. It repopulates the form as normal, but the error messages are not displayed. Filling in the required fields and the message box results in a successful submission. I ruled out the points system: changing it doesn't fix the issue. There must be an error in the code somewhere, but I'm stumped, so anyone who can spot the problem has my thanks. The PHP is in the supplied attachment. Well at a glance I can't see anything wrong with the form code, but I have 2 suggestions: One is that the error may have crept into the page containing the form itself? Can you post a link to the form page? Or, why not go back to Jems site, get the form again, and get it working, then make your modifications to it?
August 29, 200916 yr I can't post a link. Besides, there is definitely no error in the HTML. Famous last words. I've said that many a time and then found I'd done something really daft.
August 30, 200916 yr Author When I say that there is no error in the HTML, it is because there is no error in the HTML. But thank you for the useful insight anyway.
August 30, 200916 yr When I say that there is no error in the HTML, it is because there is no error in the HTML. But thank you for the useful insight anyway. Yeah HTML is pretty simple to debug... lol
August 30, 200916 yr Could you post a link to Jem's script, so we could do a side-by-side comparison and maybe see the problem? Found it - Jems Secure PHP Mail Form
September 7, 200916 yr You have $maxPoints set to 1, but have multiple references to $_POST['comments'] in the validation which will deliver a score of (or greater than) 1. Thus, the messages without comments are being marked as spam and disregarded. I'd recommend updating to the latest version (some minor tweaks in it) and then removing all score assignments that rely on $_POST['comments'] being set.
September 7, 200916 yr Author Thanks for replying, Jem. Anyway, I have sorted this out now. I downloaded a fresh copy of your script, modified it as needed, and it all works properly again.
September 7, 200916 yr When I say that there is no error in the HTML, it is because there is no error in the HTML. But thank you for the useful insight anyway. Hey, relax. I'm just saying! I remember building an image upload form but it didn't work. I spent ages trying to figure out what was wrong with the PHP when I suddenly realised I'd forgotten to include enctype. So, y'know, I'm not being facetious. I'm just telling you to check all your coding.
Create an account or sign in to comment