I want to receive an html form element by mail 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?'];
thank
try this, use the $ _POST array in foreach:
action.php
foreach ($_POST as $key => $value) echo "Field ".htmlspecialchars($key)." is ".htmlspecialchars($value)."<br>";
Hope this will be helpful.
you can just put it like $_POST["{$name}"];oryou can tie it like for example $_POST['abc_'.$name];
$_POST["{$name}"];
$_POST['abc_'.$name];
To make it more understandable See http://www.php.net/manual/en/language.types.string.php
.
$name = 'name'; $var = $_POST[$name];
name.
: print_r($_POST);
print_r($_POST);
, . <form method="post" action="action.php"><input type="hidden" name="name" value="'.$name.'">
<form method="post" action="action.php"><input type="hidden" name="name" value="'.$name.'">
action.php: $var=$_POST['name']; echo $var;
, $.
, !
Source: https://habr.com/ru/post/1648997/More articles:What are the reasons why initializing the TTS fails? - androidhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1648993/python-threading-max-number-of-threads-to-run&usg=ALkJrhig9eCmQWUY_Jre5i39_ESfvEZ1XgHow to manage a workspace Jenkins begins to build? - jenkinsAndroid -Написанный фрагмент без головы - javaHttpListenerException "access denied" using GoogleWebAuthorizationBroker.AuthorizeAsync - c #Is @PostRemove out of a transaction? - jpaHow to read millions of lines from a text file and quickly insert into a table - c #Does a Laravel rollback transaction support polymorphic relationships? - polymorphismRidge regression: Scikit-learn versus direct calculation does not match alpha> 0 - pythonMagento Product API - restAll Articles