Forum Moderators: coopster
////////////////////////////////////
<p>some text</p> <form action="/project/myfile.php" method="post"> <input type="button" name="mybutton.1" value=" mybutton "><input type="text" name="aaa" /> </form><p> some text </p> <form action="/project/myfile.php" method="post"> <input type="button" name=" mybutton.2" value=" mybutton "><input type="text" name="aaa" /> </form>
Once the button is clicked, the PHP file would get that form variable, since it is most likely the URL to redirect to, and use it (though you will loose the value if sending to HTML).
Anything you need to remember about the button click can also be added as a hidden field.
But I’m still facing a problem
This is the html file I have :
<HTML>
<HEAD>
<TITLE>A simple form</TITLE>
</HEAD>
<BODY>
<FORM method="POST" action="myfile.php">
<INPUT type="submit" name="mybutton" value="Click me!">
</FORM>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>php file</TITLE>
</HEAD>
<BODY>
<?
if(isset($_POST['mybutton'])) {
echo "this will appear when button is clicked\n";
} else {
echo "this will appear without clicking the button.\n";
}
?>
</BODY>
</HTML>
I don’t know what is the problem?