Link to home
Start Free TrialLog in
Avatar of mderbin
mderbin

asked on

Posting Data from Form - But all fields are null when processing

I am submitting the following form:
<form name="mainForm" method="post" action="index.jsp" enctype='multipart/form-data'>

with this submit button:
<input name="submit_form" type=submit value="Save" onClick="javascript:document.mainForm.submit();">

But when I get to the processing page, all of the field variables are null, for example:
<%
   String $subtitle = request.getParameter("subtitle"); //This is a field in the form
   out.println(" Subtitle_index=" + $subtitle);
   String $submit_form= request.getParameter("submit_form"); //This is the actual submit button
   out.println(" SubmitButton=" + $submit_form);
%>
Returns: "Subtitle_index=null SubmitButton=null"

I have temporarily changed the method to get, and all of the values in the fields show up in the URL, but when I make the method post, I get back a bunch of nulls.  

Am I missing something simple here?

Thanks,
Michael
Avatar of k41d3n
k41d3n

Use get not post.

You are getting the values froma  post. not posting values from a  post.
Avatar of mderbin

ASKER

But I wasn't wanting all of the data to be displayed in the URL, and it has the potential to be VERY long, so the characters in the URL will certainly run over at times.  

So I was under the impression that I would need to use a "post" method in my form.
ASKER CERTIFIED SOLUTION
Avatar of rrz
rrz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The input type submit or button have no _value_ you c! If you use java script to submit your form (i.e you need multiple submitt buttons or do some client side validation) you should use the input type button.