PHP - [Tutorial] #2 - Webforms and PHP

Discussion in 'Web Programming' started by speedster239, Sep 8, 2007.

PHP - [Tutorial] #2 - Webforms and PHP
  1. Unread #1 - Sep 8, 2007 at 10:42 PM
  2. speedster239
    Joined:
    Jan 21, 2007
    Posts:
    313
    Referrals:
    0
    Sythe Gold:
    0

    speedster239 Forum Addict
    Java Programmers

    PHP - [Tutorial] #2 - Webforms and PHP

    Difficulty: Extremely Easy

    Almost everyday you'll fill out a webform written in html. You might not know it but when you press the "accept" button their is usually a php script being executed!

    Today were going to learn how to program a simple webform where you'll enter your name and the variable will be passed to a php script in which it will be output using the "echo" function!

    Step 1:

    We going to create a simple webform as below...

    Code:
    <form action="output.php" method="post">
    Name: <input type="text" name="name"><br>
    <input type="Submit">
    </form>
    As you can see above this will create a simple form with and input bogs and a submit button. At the top where it says ( <form action="output.php" method="post"> ) this is defining that when the submit button of the form is pressed the output.php script will be executed!

    Step 2:

    Now that we've created the webform we will now create the output.php file!

    Code:
    <?
    $name=$_POST['name'];
    echo "$name";
    ?>

    The above script is very simple. It gets the post "variables" from the form we created. The variable, as defined in the form is 'name'. It gets the text value the user enters and turns it into the $name variable. Note, all variables in php are started with a "$" sign!

    The third line has the php script output the value of the name variable!

    Step 3:

    Upload these files to your webserver, run the form and it should work!

    Congratulations...
     
  3. Unread #2 - Sep 11, 2007 at 7:18 PM
  4. 1-DUB
    Joined:
    Jan 21, 2007
    Posts:
    282
    Referrals:
    0
    Sythe Gold:
    0

    1-DUB Forum Addict

    PHP - [Tutorial] #2 - Webforms and PHP

    once again nice tut and i will be looking for another one, could a mod mabey ask for a php, or weblang forum?
     
  5. Unread #3 - Sep 11, 2007 at 7:25 PM
  6. Dingo212
    Joined:
    Aug 28, 2005
    Posts:
    1,284
    Referrals:
    3
    Sythe Gold:
    14

    Dingo212 Guru

  7. Unread #4 - Sep 11, 2007 at 7:31 PM
  8. speedster239
    Joined:
    Jan 21, 2007
    Posts:
    313
    Referrals:
    0
    Sythe Gold:
    0

    speedster239 Forum Addict
    Java Programmers

    PHP - [Tutorial] #2 - Webforms and PHP

    Thanks :D, and yes..their are many more coming in both the PHP and Java sections..
     
  9. Unread #5 - Sep 11, 2007 at 8:45 PM
  10. 1-DUB
    Joined:
    Jan 21, 2007
    Posts:
    282
    Referrals:
    0
    Sythe Gold:
    0

    1-DUB Forum Addict

    PHP - [Tutorial] #2 - Webforms and PHP

    i am very pleased to here that, good luck with you tuts and hopefully you will get a user ed rank one day
     
  11. Unread #6 - Sep 13, 2007 at 3:32 PM
  12. Quikuli
    Joined:
    Aug 19, 2007
    Posts:
    79
    Referrals:
    0
    Sythe Gold:
    0

    Quikuli Member
    Banned

    PHP - [Tutorial] #2 - Webforms and PHP

    This is good tutorial too...
     
< Perl Tutorial | FileFinder, find the files you are looking for. >

Users viewing this thread
1 guest


 
 
Adblock breaks this site