|
Home >> FAQs/Tutorials >> PHP Script Tutorials and Tips >> Index
PHP Tutorials - Retrieving the Original Query String
By: FYICenter.com
(Continued from previous topic...)
How To Retrieve the Original Query String?
If you have coded some values in the URL without using the standard form GET format,
you need to retrieve those values in the original query string in $_SERVER['QUERY_STRING'].
The script below is an enhanced version of processing_forms.php which print the original query
string:
<?php
print("<html><pre>");
print(" query_string = {$_SERVER['QUERY_STRING']}\n");
$count = count($_REQUEST);
print("Number of values: $count\n");
foreach ($_REQUEST as $key=>$value) {
if (is_array($value)) {
print(" $key is an array\n");
for ($i = 0; $i < count($value); $i++) {
$sub_value = $value[$i];
if (get_magic_quotes_gpc()) {
$sub_value = stripslashes($sub_value);
}
print(" ".$key."[".$i."] = ".$sub_value."\n");
}
} else {
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
print(" $key = $value\n");
}
}
print("</pre></html>\n");
?>
(Continued on next topic...)
- How To Create a Web Form?
- What Are Form Input HTML Tags?
- How To Generate a Form?
- Where Is the Submitted Form Data Stored?
- How To Retrieve the Submitted Form Data?
- What Happens If an Expected Input Field Was Not Submitted?
- How To Avoid the Undefined Index Error?
- How To List All Values of Submitted Fields?
- What Are Input Values of SELECT Tags?
- How To Specify Input Values for Radio Buttons?
- How To Specify Input Values for Checkboxes?
- How To Retrieve Input Values for Checkboxes Properly?
- How To Supply Default Values for Text Fields?
- How To Remove Slashes on Submitted Input Values?
- How To Support Multiple Submit Buttons?
- How To Support Hidden Form Fields?
- How To Generate and Process a Form with the Same Script?
- How To Submit Values without Using a Form?
- How To Retrieve the Original Query String?
- How To Protect Special Characters in Query String?
- How To Support Multiple-Page Forms?
|