Receive form name or Submit PHP

Asked

Viewed 918 times

0

How can I receive in a function of another page the form name or Submit sent through POST?

<form class="form-inline" name="indicador" method="post" action="funcoes/indicadores.php" >

   <button type="submit" class="btn btn-theme" name="indicador">Atualizar</button>

</form>

The name="" that I will use will be dynamic, and when I receive the POST on the page functions/indicators.php I want to know what the name of the POST or SUBMIT...

  • in your example the form and the button has the same name, you can better describe which problem? Edit the question and add more details

2 answers

1


Picking up the form name is not possible. I find it easier to put a field Hidden, with the name of the form, then you take this field, or also get the name or value of the Submit button.

1

I suggest using an Hidden field, this type of field is invisible to the user, IE, it will not appear on the screen.

Example:

In this case, you place the dynamic value in the "value" attribute of the input. Ai to get this value through the POST, just use:

$valueDinamico = $_POST['example'];

I hope I’ve helped.

  • sorry, missing input example: <input type="Hidden" name="example" value="valueDynamic">

  • Correct. Thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.