We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Handling form submissions on the back end?

Development and Programming

upshot's avatar
upshot
85 posts
15 years ago
upshot's avatar upshot

I’m creating my first custom EE module. So far so good, but I have a form that allows the user to create a new record in the database. I’m sending POST data to the exact same URL that the user is on (ex: /index.php?S=978b40a8d23a6cb344283e0cddf7a0ad28c5be67&D=cp&C=addons_modules&M=show_module_cp&module=builder_db&method=add_builder), but all that happens is the user gets kicked out to the back end home page. What am I missing here that needs to be done? The form loads fine but when I POST data, why isn’t it firing the method that I’ve defined in my MCP (ex: mcp.mymodule.php) file?

–

NOTE: I’ve tried changing the “method” in the action URL to something unique and creating corresponding functions in the MCP file but I simply can’t get anything to work. It seems it’s not loading my MCP file at all…

–

NOTE: All form submissions are returning with a “302 Found” status code. It should be returning 200. What could be causing this? Here’s a sample of what happens with a typical POST of data:

POST /index.php?S=978b40a8d23a6cb344283e0cddf7a0ad28c5be67&D=cp&C=addons_modules&M=show_module_cp&module=builder_db&method=add_builder

Returns 302 Found

GET /index.php?S=978b40a8d23a6cb344283e0cddf7a0ad28c5be67&D=cp

Returns 302 Found

GET /index.php?S=978b40a8d23a6cb344283e0cddf7a0ad28c5be67&D=cp&C=homepage

Returns 200 OK and the CP Home page loads.

–

NOTE: I can confirm this is not .htaccess related.

–

Running ExpressionEngine Version 2.1.3 Build 20101220

       
upshot's avatar
upshot
85 posts
15 years ago
upshot's avatar upshot

OK, I figured it out (sort of)… disabling “Secure Mode” for forms.

What does one need to do to get play nicely with “Secure Mode”?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.