Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Extracting Parameters from GET or POST Request

Tue Oct 28, 2008 12:03 am

Code:

<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>
-->




Post a reply
  Related Posts  to : Extracting Parameters from GET or POST Request
 check request was GET or POST     -  
 Sending a post request using AJAX     -  
 Post parameters using JQuery     -  
 EXTRACTING VALUES FROM XML FILE     -  
 request for apriori package     -  
 JavaChat project request     -  
 Game code request     -  
 Get address of the page from which the request was made     -  
 Request on Soa, SoapUI, Web services, SaaS     -  
 AJAX - Sending a request to a server     -  

Topic Tags

PHP GET/POST