Interactive Parabola Grapher
Explore graph ,equation and the locus of a Parabola
Save graphs to your desktop!



A+    A−    B  
Home
Graphing Calc
Algebra
Math Games
  • Decimals in Space
  • Fraction Balls
  • Integers in Space
  • Math Man
  • Number Balls
  • Geometry
    Interactive
    Trigonometry
    Scientific Calc

    PHP Forms: Get and Post

    Submitting Forms and retrieving the data

    Name:
    Password
    Copy and Paste the code into a web page , start apache and then type in a username and passoword.
    
    <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ;?> ">
    Name:<input type="text" name="username"> <br />
    Password <input type="password" name="pword"><br />
    <input type="submit">
    </form>
    <?php
    echo $_POST['username'] . " and password " . $_POST['pword'] ;
    ?>

    Part II. Write a custom function that performs the log in

    function getUname(){
    echo $_POST['username'] . " and password " . $_POST['pword'] ;
    if($_POST['username'] =='' || $_POST['pword']=='')
    echo 'You did not enter a username and password'; } >  if(isset($_POST['username'])&& $_POST['username']!="" && isset($_POST['pword'])&& $_POST['pword']!='' ) getUname();

    How to use GET

    Click Me
    <?php
    $url = $_SERVER['PHP_SELF'] .'?username=joe&age=33';
    $link= "<a href='$url'>Click Me </a>";
    
    if(isset($_GET['username']) && isset($_GET['age']))
    	{
    	echo $_GET['username'] . ' is ' .$_GET['age'] ;
    	}
    else 
    	echo $link;
     ?>
    
    One final note, you should always filter variables that come from the outside. It would be very easy for someone to hack our server based on our current code. To help combat this problem use strip_tags();so always use strip_tags($_GET['varable]) around variables that you are taking in from a user. This prevents them from deleting files on your server etc..
    Now you're ready to start leanring about sessions
    Create a new php page with this and try figuring out what's going on.