Skip to content

Commit

Permalink
adding form submission examples
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdavidmills committed Feb 21, 2017
1 parent 2f9e2ea commit a45b4fe
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 0 deletions.
42 changes: 42 additions & 0 deletions html/forms/sending-form-data/get-method.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Get method example</title>
<style>
form {
width: 420px;
}

div {
margin-bottom: 20px;
}

label {
display: inline-block;
width: 240px;
text-align: right;
padding-right: 10px;
}

button, input {
float: right;
}
</style>
</head>
<body>
<form action="http://foo.com" method="get">
<div>
<label for="say">What greeting do you want to say?</label>
<input name="say" id="say" value="Hi">
</div>
<div>
<label for="to">Who do you want to say it to?</label>
<input name="to" value="Mom">
</div>
<div>
<button>Send my greetings</button>
</div>
</form>
</body>
</html>
42 changes: 42 additions & 0 deletions html/forms/sending-form-data/php-example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PHP form submission example</title>
<style>
form {
width: 420px;
}

div {
margin-bottom: 20px;
}

label {
display: inline-block;
width: 240px;
text-align: right;
padding-right: 10px;
}

button, input {
float: right;
}
</style>
</head>
<body>
<form method="post" action="php-example.php">
<div>
<label for="say">What greeting do you want to say?</label>
<input name="say" id="say" value="Hi">
</div>
<div>
<label for="to">Who do you want to say it to?</label>
<input name="to" value="Mom">
</div>
<div>
<button>Send my greetings</button>
</div>
</form>
</body>
</html>
8 changes: 8 additions & 0 deletions html/forms/sending-form-data/php-example.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
// The global $_POST variable allows you to access the data sent with the POST method by name
// To access the data sent with the GET method, you can use $_GET
$say = htmlspecialchars($_POST['say']);
$to = htmlspecialchars($_POST['to']);

echo $say, ' ', $to;
?>
42 changes: 42 additions & 0 deletions html/forms/sending-form-data/post-method.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Post method example</title>
<style>
form {
width: 420px;
}

div {
margin-bottom: 20px;
}

label {
display: inline-block;
width: 240px;
text-align: right;
padding-right: 10px;
}

button, input {
float: right;
}
</style>
</head>
<body>
<form action="http://foo.com" method="post">
<div>
<label for="say">What greeting do you want to say?</label>
<input name="say" id="say" value="Hi">
</div>
<div>
<label for="to">Who do you want to say it to?</label>
<input name="to" value="Mom">
</div>
<div>
<button>Send my greetings</button>
</div>
</form>
</body>
</html>
Binary file added html/forms/sending-form-data/process-data.cgi
Binary file not shown.
Binary file added html/forms/sending-form-data/python-example.cgi
Binary file not shown.

0 comments on commit a45b4fe

Please sign in to comment.