Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP form script no longer working

Featured Replies

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

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?

  • Author

I can't post a link. Besides, there is definitely no error in the HTML.

  • Author

Can anyone else help?

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.

  • 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.

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

  • 2 weeks later...

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.

  • 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.

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.