forked from mdn/learning-area
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2f9e2ea
commit a45b4fe
Showing
6 changed files
with
134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Binary file not shown.