Register|Login

Have a question? Click here to ask the community.

Tutorial 21 – Get, Post, & Request

| In: 21. GET & POST | 19,385 views

Video Tutorial

Part 1


Video Source Code

File: form_get.php

1
2
3
4
5
6
7
8
9
10
11
12
13
<html>
<body>
<!-- Tutorial Description: GET/POST/REQUEST Variable -->
 
<form action="form_successRequest.php" method="get">
First Name: <input type="text" name="firstName" /><br>
Last Name: <input type="text" name="lastName" /><br>
Email: <input type="text" name="email" /><br>
<input type="submit" />
</form>
 
</body>
</html>

File: form_post.php

1
2
3
4
5
6
7
8
9
10
11
12
13
<html>
<body>
<!-- Tutorial Description: GET/POST/REQUEST Variable -->
 
<form action="form_successRequest.php" method="post">
First Name: <input type="text" name="firstName" /><br>
Last Name: <input type="text" name="lastName" /><br>
Email: <input type="text" name="email" /><br>
<input type="submit" />
</form>
 
</body>
</html>

File: form_success.php

1
2
3
4
5
6
7
8
<html>
<body>
 
Hello <?php echo $_POST["firstName"]; ?>, your email,
<?php echo $_POST["email"]; ?>, has now been added.
 
</body>
</html>

File: form_successGet.php

1
2
3
4
5
6
7
8
<html>
<body>
 
Hello <?php echo $_GET["firstName"]; ?>, your email,
<?php echo $_GET["email"]; ?>, has now been added.
 
</body>
</html>

File: form_successRequest.php

1
2
3
4
5
6
7
8
<html>
<body>
 
Hello <?php echo $_REQUEST["firstName"]; ?>, your email,
<?php echo $_REQUEST["email"]; ?>, has now been added.
 
</body>
</html>

Comment Form

You must be logged in to post a comment.