POST array is empty with SEF URIs?
Posted: 27 November 2008 04:48 PM   [ Ignore ]  
Summer Student
Total Posts:  12
Joined  07-18-2008

Exactly why this occurs is beyond the capabilities of my tiny brain, and I’d really appreciate one of you gurus out there to post what the reason for this is, but in the interim I’m posting this here because I’ve had this issue twice now and it might save someone else a bit of stress smile

Removing the index.php from the URI is great for SEO, but if you’re creating a ‘normal’ HTML form with the standard syntax of:

<form id="form_name" method="POST" action="url/to/my/next/file" />

be aware that the url in the action needs to INCLUDE the index.php. Otherwise, the form you’re aiming at, to do something wonderful with your POSTed variables will look blankly at you and wonder why you’re shouting at it. The POST array will be empty.

My thought was that the URI would be parsed by the .htaccess file when a new webpage was ‘called’ by such an internal link. However, this doesn’t seem to be the case.

Put the index.php back in the stated URI and hey presto the POST array is populated in the receiving page.

I’m using LG .htaccess Generator to remove the index.php in the URI (using the default extension settings) and I don’t know whether this is an EE thing or an LG thing, but I’m guessing it’s the way EE deals with POST requests.

 Signature 

RentanApartmentinSpain.com

Profile
 
 
   
 
 
‹‹ Moving Hosting      LG TinyMCE Error ››
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 66391 Total Logged-in Users: 46
Total Topics: 84715 Total Anonymous Users: 15
Total Replies: 454694 Total Guests: 188
Total Posts: 539409    
Members ( View Memberlist )