Latest tutorial: Making a Movieclip face another Movieclip or point on the stage | Ask Tutorial5!
 

PHP Forms

(11 votes)
Written by DanielRo   
In our contact us script tutorial you learned the basics of creating contact forms using a PHP file and a HTML form. In this tutorial we are using only one master php file, containing both the form and the php code.



In our first tutorial we used the basic approach, a HTML FORM witch sends data using POST to a PHP file. Nonetheless this is not a bad approach in creating forms and parsing data to PHP files but as you are developing a better, stronger, faster application you will need more and more forms thus creating two files for every form can get real ugly real fast.

In this technique a single PHP file is being used, containing both the HTML FORM and the PHP script.

Here is the actual script:

<?
/*Check to see if the FORM was submitted (if the "SEND" value was sent)*/
if(isset($_POST['send']))
{
/* Get the "username" and "password" values from the form */
$user = $_POST['username'];
$pass = $_POST['password'];

/* This is the place where you connect to your database
or whatever function you are using after the form is submited */
}

/* If the "send" value was not sent, then the form is displayed */
else {
?>
<form method="post" action="<?=$_SERVER['PHP_SELF'];?>">
Username:
<input name="username" type="text"><br>
Password:
<input name="password" type="password"><br>
<input name="send" type="submit" value="Login">
</form>
<? } ?>



Subscribe now via RSS feed and get all the new tutorials

written by arun , October 18, 2007

hai this is very useful for me
written by barry manville , May 20, 2008

looking for tutorial to create a numbered sequence of forms--in this case want to offer a certificate that is sequentially numbered and where the customer can input a name.

end result would be a down loaded certificate that is numbered and has customers name on--
written by anbugopal , June 10, 2009

yes, need for flash action script
written by ALex255 , August 21, 2009

dkgfhkqhgkkeqgq
rqegheqrghieghithightiitigirtihwwñ{erwgrtikghiwerg
w}
wgh
written by mby247 , June 06, 2010

Pls I need help. I got two tables on a database but I dont know how to run them independently. Please find below our script. It is a shipping tracking website. All I want is each table to run independently once tracked.

-------------------------------------------------






How do I write or connect the second usertable to the php file as the first script which is working fine once tracked? The table name is "FTYX34555867". I don't know how to run or write multiple table on same database. All I need is, how to connect multiplt tables so each table can run different tracking number. Am stress as am not getting it well. Please help me.

Do you need more help? Ask now!
 

busy
Last Updated ( Sunday, 14 October 2007 )