[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fastcgipp-users] Re: form handler crashing if posts key missing

From: ninti
Subject: [Fastcgipp-users] Re: form handler crashing if posts key missing
Date: Wed, 6 Jan 2010 00:13:40 +1030

Hmm, looks like I may have solved this one too .. 
If I change the form's enctype to 'multipart/form-data', blank form fields are 
longer fatal. 
Does this sound right? 
Note: I've included the original post below as seemed to be down 
and I'm not sure it ever made it through: 
I am having issues with a form handling program crashing whenever an expected 
environment.posts[ ] key is not present. 
I can test for the existence of the key using environment.postVariableExists(), 
but all attempts to handle this so far have not worked and the program still 
For example: 
std::string input_name; 
if (environment.postVariableExists("name")) { 
input_name = environment.posts["name"].value; 
else { 
input_name = "empty"; 
// now do something with input_name; 
Program works fine if key is present, but crashes if not. 
I would expect that the contents of the 'if' block would only be examined if 
key existed, but it appears that maybe that isn't the case. 
Any suggestions on how to handle missing POST data gratefully accepted. 
I am using Nginx + FastCGI is that is relevant. 
Mike ) 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]