Jump to content

Recommended Posts

Posted

Hi folks,

I have a form with repeated fields, so I am using the array notation in naming them (name="myfield[]").

I also use this for naming a hidden field.

When I catch the contents of the form using the pw $input->post variable I properly get the contents of all arrays except the

contents of the hidden field array. The hidden field array is completely empty though before submitting the form

all hidden fields were populated.

Is there a pw bug or did I commit an error in handling the fields?

 

thanx, Helmut

 

Posted

I tried to reproduce and got what I have expected.
My template file:

<?php   
    var_dump($input->post->hidden); // array(3) { [0]=> string(3) "123" [1]=> string(3) "456" [2]=> string(3) "789" }
?>
<form action='/test/' method='post'>
    <input type="text" name="text[]" value="Hello"/>
    <input type="text" name="text[]" value="Jo"/>

    <input type="hidden" name="hidden[]" value="123"/>
    <input type="hidden" name="hidden[]" value="456"/>
    <input type="hidden" name="hidden[]" value="789"/>
    <input type="submit" value="go">
</form>

 

  • Like 2
Posted
1 hour ago, kixe said:

I tried to reproduce and got what I have expected.
My template file:


<?php   
    var_dump($input->post->hidden); // array(3) { [0]=> string(3) "123" [1]=> string(3) "456" [2]=> string(3) "789" }
?>
<form action='/test/' method='post'>
    <input type="text" name="text[]" value="Hello"/>
    <input type="text" name="text[]" value="Jo"/>

    <input type="hidden" name="hidden[]" value="123"/>
    <input type="hidden" name="hidden[]" value="456"/>
    <input type="hidden" name="hidden[]" value="789"/>
    <input type="submit" value="go">
</form>

 

thanks for your quick answer. 

I played a little with the code and suddenly it was working.

As I used another naming method before, I probably got the wrong result from the browser cache.

thanks anyway!

  • Like 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...