Jump to content

Explain:"$fieldname = $_REQUEST['fieldname']"


dogbot

Recommended Posts

NEWBIE ALERT:

New to Programming

Newer to PHP

Bad at formulating coherent questions.....so here it goes....

 

Could someone explain

$fieldname = $_REQUEST['fieldname']

 

I understand "$_REQUEST An associative array that by default contains the contents of $_GET, $_POST and $_COOKIE"

 

I also understand you call the member of an array like so: 

<?php
$arr = array("foo" => "bar", 12 => true);

echo $arr["foo"]; // bar
echo $arr[12];    // 1
?>

 

So I would expect that if someone wants to use something from the $_REQUEST Array they would use:

$fieldname = $_REQUEST['$_GET']

So I do not understand why "$fieldname" is inside the brackets.I suspect they might be setting this up to use $fieldname instead of $_REQUEST maybe...but why, that would be redundant? so I suspect I suspect wrong....

Link to comment
https://forums.phpfreaks.com/topic/231880-explainfieldname-_requestfieldname/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.