Search code examples
phphtmlcssforms

How to fetch the GET/POST elements in a form without knowing the name of the controls inside the form


I had the list of items. When the user clicks a item, a div is generated with a textbox:

<input type="text" name="(DYNAMICALLY ASSIGNED VALUE)" />

So user can select multiple items. For each item a textbox is generated dynamically inside the form. When the user clicks the submit button, I want to fetch the GET/POSTED elements. How can we achieve that?


Solution

  • You can use a for-each loop:

    foreach ($_GET as $get_key => $get_value)