Extracting Parameters from Either a GET or POST Request : GET POST : Development PHP Source Code


PHP Source Code » Development » GET POST »

 

Extracting Parameters from Either a GET or POST Request





<html>
<head>
<title>An HTML form including a SELECT element</title>
</head>
<body>
<form action="formDataReadFromGETorPOSTRequest.php" method="POST">
  <input type="text" name="user">
  <br>
  <textarea name="address" rows="5" cols="40"></textarea>
  <br>
  <select name="products[]" multiple>
    <option>option1
    <option>option2
    <option>option3
    <option>option4
  </select>
  <br>
  <input type="submit" value="OK">
</form>
</body>
</html>

<!-- formDataReadFromGETorPOSTRequest.php

<html>
<head>
<title>Extracting parameters from either a GET or POST request</title>
</head>
<body>
<?php
$PARAMS = (isset($HTTP_POST_VARS)) ? $HTTP_POST_VARS : $HTTP_GET_VARS;

foreach $PARAMS as $key=>$value ){
  if gettype$value == "array" ){
     print "$key == <br>n";
     foreach $value as $two_dim_value )
        print "...$two_dim_value<br>";
  }else {
     print "$key == $value<br>n";
  }
}
?>
</body>
</html>
-->
           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Development
» GET POST