2

I have the following form that is dynamically generated:

<form action="index.php?route=module/print_wizard/showPrintSheet&amp;token=4ef5f4af6ba25d6096357fdb4809e819" method="post" enctype="multipart/form-data" id="form">
    <input name="[print][6][1]" type="hidden" value="on">
    <input name="[print][6][3]" type="hidden" value="on">
    <input name="[info]" type="hidden" value="INV-GIS-00002-3">
    <input name="[layout_override][6][1]" type="hidden" value="">
    <input name="[layout_override][6][3]" type="hidden" value="">
    <input name="[bundle_override][6][1]" type="hidden" value="">
    <input name="[bundle_override][6][3]" type="hidden" value="">
    <input name="[run_id]" type="hidden" value="14040455">
    <button type="submit">Export</button>
</form>

My PHP code is:

var_dump($_POST);
echo "<HR>".$this->request->server['REQUEST_METHOD'];

I have done this a million times before and can not for the life of me figure out why my $_post array is empty. I have changed my post to a get and all the fields and values are passing, but I need to use a post. Do I need to have one visible form element? Please help!

13
  • 3
    Can you add the actual generated form code? Which framework are you using? Commented Apr 14, 2014 at 17:14
  • Do you have a form tag? Does that form tag have a method="post"? Are your hidden input inside of that form tag? Commented Apr 14, 2014 at 17:15
  • How are you simulate POST request? Commented Apr 14, 2014 at 17:15
  • Are your inputs inside the form? Commented Apr 14, 2014 at 17:16
  • Are you sure you have set the form method to POST? Commented Apr 14, 2014 at 17:17

1 Answer 1

2

You are not using valid names for your form fields:

<input name="[print][6][1]" type="hidden" value="on">

is not valid as it just has an array index but no name.

If you change it to for example:

<input name="print[6][1]" type="hidden" value="on">

it will work without any problems.

Sign up to request clarification or add additional context in comments.

1 Comment

OMG I'm an idiot! Thank you so much! I was pulling my hair out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.