detect click on submit button in PHP
Posted
by Remus Rigo
on Stack Overflow
See other posts from Stack Overflow
or by Remus Rigo
Published on 2010-03-27T17:59:38Z
Indexed on
2010/03/27
18:03 UTC
Read the original article
Hit count: 136
php
hi all
I have a php file that contains a form (witch contains 2 input boxes and a submit button) for updating a contact. I managed to fill the fields with the contact's data, but I can't detect if the submit button is clicked
form looks like this
echo "<form action=Contact.php><table>".
"<tr><td>First Name</td><td><input type=text size=75% name=FirstName value='".$row['FirstName']."'></td></tr>".
"<tr><td>Last Name</td><td><input type=text size=75% name=LastName value='".$row['LastName']."'></td></tr>".
"<tr><td colspan=2><input type=submit name=UpdateContact value=Update></td></tr>".
"</table></form>";
this code should output a "clicked" message if the button is clicked
if (isset($_POST['UpdateContact']))
{
echo "<p>clicked";
}
else
{
echo "<p>not clicked";
}
can anyone help me out or tell me what i've done wrong
(I want from the same php file to fill the contact's data in a from and to update the database)
© Stack Overflow or respective owner