ccorrea - 2009-03-28

A few days ago, I posted a problem to this forum as follows:

>>I set up this form a couple of days back (performance review) and uploaded to the server. I just need the results sent to the email, and I have the confirm.html set (I see it in the php code).

When I test the form and hit "submit" I get a blank page. No confirmation, no email. 

All associated files and folders are in the original locations as when it created.

Can someone help out with this? I spent a lot of time setting up this detailed form the other day.

Thanks! <<

Although some tried to help (thank you), and I even found old postings on this forum going back at least 4 years for the same exact problem, there wasn't any solution I could find in those postings.  I had my own programmer look at the form to help me, and he solved the mystery.  I'm posting this here for anyone else that may not be php knowledgable or have a high level computer skills.  This form generator is extremely easy to use - and should be a matter of creating, uploading and using. Therefore, it should be useful for any person with basic skills that needs a form - however, it is important that little nuances like this be properly explained for us that are not as skilled - it sure saves a lot of time and frustration. 

The issue with my form not working and giving a blank screen after hitting "submit" was simply because of the use of apostrophe's and quotations in the field text boxes.  Once I took these OUT of the processor.php, the form worked perfectly.  I hope this helps others in the future. I have posted the full response from my programmer below for the benefit of anyone that cares to read up on this.  I know I learned something new from him. 

CC

>You did mention that you had problems with apostrophes in this
> application. They are problematic in PHP, and they give programmers all
> kinds of trouble. One thing that makes them difficult is that some
> servers will automatically insert characters in front of quotes (this
> feature is called "magic quotes"), and some do not. Some host providers
> have it turned on and some have it turn off. The setting is server-wide,
> so the client of the hosting company does not get a choice. You should
> really write your code to detect whether or not this setting is enabled,
> then adjust quotes accordingly. And even when you try to do it right,
> it's still easy to mess it up. In any case, you are right, the system
> should handle them properly in the environment in which the application
> is running.
>
> But the apostrophe is not the only character that is problematic -
> quotation marks are problematic as well. In your form you have a "3"
> enclosed in quotation marks. The form processor takes your text and
> drops it into a quoted string. So when you write:
>
> If you rated anything less than "3", please explain:
>
> The system dropped that into a quoted string when generating the PHP
> code, as follows:
>
> "If you rated anything less than "3", please explain:"
>
> PHP looks at this and thinks the quoted string ends just before the 3...
> "If you rated anything less than "
>
> then it encounters the 3 (which it interprets as being outside the
> quoted string), and a 3 standing by itself is not valid PHP code.
>
> So, that's the long explanation. The short of it is that the 3 in quotes
> is what's tripping up this program.
>
> You can probably take processor.php, look for the 3 in quotes and just
> remove the quote characters. I think it will work ok if you do that.
>
> Or, if you want to keep the quotes, try inserting a backslash before the
> quotes, as follows:
>
> "If you rated anything less than \"3\", please explain:"
>
> The backslash tells PHP that you really want the quote that follows it
> to be part of the string, and not the character that signals the end of
> the string. The backslash will not appear when the browser displays the
> form.
>
> I think that will do it for you. Give it a try and let me know how it goes.

end//