WebSite X5Help Center

 
Debbie W.
Debbie W.
User

Multiple choice email form crashes website with "undefined index" error  en

Autor: Debbie W.
Visited 2148, Followers 1, Udostępniony 0  

We have an email form object with a multiple choice and single choice questions. If the user clicks Send without choosing an option from these two sets of questions, an error message is generated. 

undefined index: imObjectForm_2_4 in/clientdata/n5200-2-dynamic/i/n/domain name/www/imemail/imEmailForm_l5g8rplk.php on line 8

undefined index: imObjectForm_2_5 in/clientdata/n5200-2-dynamic/i/n/domain name/www/imemail/imEmailForm_l5g8rplk.php on line 9

We had this previously working with Contact details and 1 multiple choice non-mandatory, and 1 single choice mandatory. When we added an additional multiple choice non- mandatory, we get the error messages.

Any help would be appreciated. 

Posted on the
5 ODPOWIEDZI - 1 POMOCNY
Aleksej H.
Aleksej H.
Moderator

Hello. The version of PHP on the hosting should be 7.1 or 7.2. Check server logs. If there are errors or blocked requests, then contact the technical support service of your hosting provider.

Czytaj więcej
Posted on the from Aleksej H.
Paul M.
Paul M.
Moderator

Hello Debbie,

Please see my reply to another WebSite X5 user in the following thread, as their issue was identical to your own:

https://helpcenter.websitex5.com/pl/post/153507

This phenomenon is a combination of the level of PHP error reporting set on your server (which is within your control), and the current inability to specify a default selection for form fields within WebSite X5 (which is unfortunately not within your control).

If you suppress PHP warning notices on the server then your page will display correctly and your form will work.  Your webhost will be able to help you with this if you're unsure how to do it yourself.  Ask them to send PHP notices to an error log instead of the screen.

If we can be of further assistance please let us know.

Kind regards,

Paul

Search the WebSite X5 Help Center (multilingual)

Czytaj więcej
Posted on the from Paul M.
Debbie W.
Debbie W.
User
Autor

Thanks for your replies. We have been in touch with our web host to see whether we can suppress error reporting and they have recommended changing to a more recent server. Not sure why the existing one doesn't work any longer.

Czytaj więcej
Posted on the from Debbie W.
Debbie W.
Debbie W.
User
Autor

In case this helps some-one else, we have worked out that when our website (or part of it) is uploaded, a file called imEmailForm_xxxxxxxx.php is created in the imemail folder, where the xs are random letters and/or numbers. If we edit this file and include error_reporting(0); on the line after <?php our form works (i.e. the error message is suppressed) and the website works as we want it to.

We will need to make the above edit each time we upload our website.

Czytaj więcej
Posted on the from Debbie W.
Paul M.
Paul M.
Moderator

Thanks for the update, Debbie.

However, you shouldn't have to manually add that line to each new WebSite X5 form.  You can do that of course if you prefer, but PHP error reporting is normally configured on a more global level.

One way to achieve this is to use an .htaccess file on your server.

Another way is to make an entry in a PHP .ini file on your server.

And the easiest method of all is to use the controls built-in to most webhosting control panels (see the screenshot below):

Your webhost should be able to advise you on how to implement any of these methods to suit your specific requirements.

Czytaj więcej
Posted on the from Paul M.