Difference between revisions of "Receiving GET parameters"
From MyWiki
| Line 2: | Line 2: | ||
| − | <html> <head><title>PHP Get Results</title></head> <body> <?php // Show all URL parameters (and // all form data submitted via the // 'get' method) foreach($_GET as $key=>$value){ echo $key, ' => ', $value, "<br/>n"; } // Show a particular value. $id = $_GET['id']; if($id) { echo '<p/>ID: ', $id, "<br/>n"; } else { echo '<p>No ID parameter.</p>'; } ?> </body> </html> | + | <html> <head><title>PHP Get Results</title></head> |
| + | <body> <?php // Show all URL parameters (and // all form data submitted via the // 'get' method) | ||
| + | foreach($_GET as $key=>$value) | ||
| + | { echo $key, ' => ', $value, "<br/>n"; } | ||
| + | // Show a particular value. | ||
| + | $id = $_GET['id']; if($id) | ||
| + | { echo '<p/>ID: ', $id, "<br/>n"; } | ||
| + | else { echo '<p>No ID parameter.</p>'; } | ||
| + | ?> | ||
| + | </body> </html> | ||
Revision as of 19:31, 14 September 2014
< source lang="html4strict">
<html> <head><title>PHP Get Results</title></head>
<body> <?php // Show all URL parameters (and // all form data submitted via the // 'get' method)
foreach($_GET as $key=>$value)
{ echo $key, ' => ', $value, "
n"; }
// Show a particular value.
$id = $_GET['id']; if($id)
{ echo '<p/>ID: ', $id, "
n"; }
No ID parameter.
'; }?> </body> </html>