Question: I am coding a PHP script, but I can't really seem to get it to work. I am testing out the basics, but I don't really understand what GET and POST means, what's the difference? All the definitions I've seen on the web make not much sense to me, what I've coded so far (but since I don't understand POST and GET, I don't know how to get it to work:

```
    <form name="mail_sub" method="get">
Name: <input type="text" name="theirname"> <br />
Email:&nbsp; <input type="text" name="theirpass"> <br />
<input type="submit" value="Join!" style="width:200px">
</form>
<?php
if (isset($_POST['mail_sub']))
    {

    echo $_POST['theirname'];

    }
?>

```

Answer: 
Post is like "sending" the data to the page without giving the user having any interaction with it, when Get shows the parameters in the URL and making it public for the user. Get is more often used on "unsecure" type of datatransactions like for example a searchform and POST is used when you want to make more secure things like a login form. 

Using a Get will give you like
index.php?parameter=hello&parameter2=world

In your example you should use either POST in the method attribute in the formtag or $\_GET in the php section

So either 

```
<form name="mail_sub" method="post">
Name: <input type="text" name="theirname"> <br />
Email:&nbsp; <input type="text" name="theirpass"> <br />
<input type="submit" value="Join!" style="width:200px">
</form>
<?php
if (isset($_POST['theirname']))
{

echo $_POST['theirname'];

}
?>

```

or

```
<form name="mail_sub" method="get">
Name: <input type="text" name="theirname"> <br />
Email:&nbsp; <input type="text" name="theirpass"> <br />
<input type="submit" value="Join!" style="width:200px">
</form>
<?php
if (isset($_GET['theirname']))
{

echo $_GET['theirname'];

}
?>

```
GET - If form method is GET then on submitting the form, Form will be submitted to

```
xyz.com/submit.php?theirname=john&theirpass=password   // CHECK HERE - form elements are in URL so not so secure

```

and can be checked by PHP
as 

```
if(isset($_GET['their']))
{
$name=$_GET['their'];  //name will return John
}

```

POST - If form method is POST then on submitting the form, Form will be submitted to

```
xyz.com/submit.php   // CHECK HERE form elements are not in URL

```

and can be checked by PHP
as 

```
if(isset($_POST['their']))
{
$name=$_POST['their'];  //name will return John
} 

```