Hello, I am a newbie to php. I am trying to figure out how to call a function when a user clicks submit on a form. I have a sample script that I am writing where the user inputs there name, address, etc.. and then clicks submit and it inserts into the mysql database. I have successfully done this with form action to my adduser.php file, but I would rather have a single function file with adduser, delete a user, edit a user, etc..
here is my form
<form action="includes/customersfunctions.php?add" method="post">
name: <input type="text" name="name" /><br />
address: <input type="text" name="address" /><br />
city: <input type="text" name="city" /><br />
state: <input type="text" name="state" /><br />
zip: <input type="text" name="zip" /><br />
<input type="submit" />
</form>
Here is my function
<?php
function add()
{
include("config.php");
mysql_query("INSERT INTO customers (name,address,city,state,zip) VALUES ('name','address','city','state','zip') ") or die(mysql_error());
echo "added";
mysql_close($con);
}
?>
The function will have delete, update, etc.. later
Thanks for your help in advance!