Skip to content

Instantly share code, notes, and snippets.

@DaniloCeesar
Created May 18, 2021 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaniloCeesar/b49ec6a77f3d75380fe0b689afbfe065 to your computer and use it in GitHub Desktop.
Save DaniloCeesar/b49ec6a77f3d75380fe0b689afbfe065 to your computer and use it in GitHub Desktop.
Example POST request
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Electronic form</title>
</head>
<body>
<form method="POST" id="webform" name="webform" action="target.php">
<label for="iduser">User ID:</label>
<input type="text" id="iduser" name="iduser"> <br />
<label for="idplaylist">Playlist ID:</label>
<input type="text" id="idplaylist" name="idplaylist"> <br />
<label for="v">Video ID:</label>
<input type="text" id="v" name="v"> <br />
<button type="submit">Send data</button>
</form>
</body>
</html>
<?php
// Prints the values of each field on the page
echo(
"The user identified as " . htmlspecialchars($_POST["iduser"], ENT_QUOTES, "UTF-8") . " added the video whose ID is " . htmlspecialchars($_POST["v"], ENT_QUOTES, "UTF-8") . " to the playlist " . htmlspecialchars($_POST["idplaylist"], ENT_QUOTES, "UTF-8") . "."
);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment