Calling a php function from an html form action
Posted: Fri Aug 15, 2008 5:53 am
I am trying to get this to work:
<?php
function afunction()
{
some php code that generates an unlock code;
}
echo "<form name='input' action='afunction()' method='post'>";
{
echo "Enter serial number:";
echo "<input type='text' name='serial'>";
echo "<input type='submit' value='Generate Unlock Code'>";
echo "<br/>";
}
echo "</form>";
?>
but I get a 404 error "Can't find page afunction()"
How do I execute afunction() from the form action??
G
<?php
function afunction()
{
some php code that generates an unlock code;
}
echo "<form name='input' action='afunction()' method='post'>";
{
echo "Enter serial number:";
echo "<input type='text' name='serial'>";
echo "<input type='submit' value='Generate Unlock Code'>";
echo "<br/>";
}
echo "</form>";
?>
but I get a 404 error "Can't find page afunction()"
How do I execute afunction() from the form action??
G