I want to get html form element by post with the name being a php variable
example :
<form method="post" action="action.php"><input type="submit" name="'.$name.'"></form>
action.php code:
$var=$_POST['What do i put here?'];
Thanks
try this, use $_POST array in foreach:
action.php
foreach ($_POST as $key => $value)
echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
i hope it will be helpful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With