0

I have an ee site that has tons of forms that are currently live. These forms are submitting data to a third party service using that service's custom submission code (which has nothing to do with ee addon code - I think the service is just using CURL).

I need to implement additional validation for these forms on the PHP side before I pass the data to the service. I kind of need a middle layer which processes the data I guess. The forms are in plain html and are stored as snippets or low variables.

I do not need to save the data. I only need to

  • validate form inputs
  • filter out bad input characters
  • throw back errors and redirect to form if form data is invalid
  • send data to the service if the form is valid

How should I do this? Should I write a plugin, extension, module? I only need to process the data not build the form. What should I write?

3

You don't need to run this through EE at all if you don't want to. Simply create your PHP script outside of EE's templates and have the form post its data there.

I did something very similar to what you need recently to send data from a contact form to a CRM system. They supplied a ready made PHP script (which used CURL) to get the data to the CRM. I just set my form to post to the script they gave me.

UPDATE: Here's my htaccess redirect rule in case you have a problem

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
Options All -Indexes
  • Hey my setup involves a CRM too. Could you tell me where exactly in my ee project structure could I create a PHP script? Wouldn't all requests be sent to index.php via the .htaccesss? A little confused about this – Amit Erandole May 8 '14 at 17:41
  • 1
    it can go wherever you like. I created a directory in the web root. Depending how you set up your htaccess you shouldn't have a problem. I'll update my answer with my redirect rule. – foamcow May 8 '14 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.