Skip to content
Advertisement

PHP – unable to echo variables $error and $successMessage

This is a form validation code. I have a bootstrap form but my alerts don’t show up for some reason. My form is here – https://trendingpunjabi.com/test.php.

I am able to do form validation in javascript but want this to work as well.

JavaScript

Advertisement

Answer

I got my answer from other source. See the text that follows:

“A quick look at the page’s source shows this line:

Which means that line is being sent to the client rather than the php being processed on the server. That will almost certainly be due to using <? rather than <?php

Support for the short form <? is enabled through a setting on the server in .user.ini, generally it’s always wise to use <?php as that is guaranteed to work even if your code moves to another server.”

Thanks

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement