Hello,
Is it possible to use the form name as a variable in php?
Something like:
echo "\n<form name=\"myform\" action=\"./index.php?test=1\" method=\"POST\">";
Now how can I read the name of the form with php
I was hoping for something like $_POST['formname'] but does not work.
Thanks.
PHP and Form names
Moderator: General Moderators
usually, 2 forms on a page also have differenct submit buttons...
and then in your code you test
Code: Select all
<form action="" method="post">
<input type="submit" name="form1" value="post form1" />
</form>
<form action="" method="post">
<input type="submit" name="form2" value="post form2" />
</form>Code: Select all
if (isset($_POST['form1'])) {
// do stuff with form1
}
if (isset($_POST['form2'])) {
// do stuff with form2...
}