By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,723 Members | 1,876 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,723 IT Pros & Developers. It's quick & easy.

Retrieve formname

P: n/a
Hi,

In my PHP script I want to put the name of the form, i'm currently in, into
a variable.

So far I haven't found an answer!

Greetz,

Bigfoot
Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Bigfoot wrote:
In my PHP script I want to put the name of the form, i'm currently in, into
a variable.


Make your form send its name to the php script using a hidden
input field (line 4):

1 <html><head><title>form name</title></head>
2 <body>
3 <form name="testform" action="xyz.php" method="post">
4 <input type="hidden" name="formname" value="testform" />
5 bla bla bla <input type="text" name="input1" /> bla bla bla
6 <input type="submit" value="TEST ME!" />
7 </form>
8 </body></html>

and in xyz.php
<?php
$submitted_form = $_POST['formname'];
?>
--
"Yes, I'm positive."
"Are you sure?"
"Help, somebody has stolen one of my electrons!"
Two atoms are talking:
Jul 16 '05 #2

P: n/a
> Make your form send its name to the php script using a hidden
input field (line 4):

1 <html><head><title>form name</title></head>
2 <body>
3 <form name="testform" action="xyz.php" method="post">
4 <input type="hidden" name="formname" value="testform" />
5 bla bla bla <input type="text" name="input1" /> bla bla bla
6 <input type="submit" value="TEST ME!" />
7 </form>
8 </body></html>

and in xyz.php
<?php
$submitted_form = $_POST['formname'];
?>


Thanx mate!
Jul 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.