Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

Need to find key with value, replace that value

Hello,

The code below I am pulling info from post and placing into a variable.  Now I need to find a specific key in that varable and replace only that.  Any thoughts?

Thanks
foreach($_POST as $key=>$value){
		if ($key!="M_unecpss"){
	//		print "Name KEY=".$key." and VALUE=".$value."<BR>";
			$VARS = $VARS."&".$key."=".$value;
		}
	}
	$VARS = $VARS."&iFind_MSISDN=".$MSISDN;
	//print "Name KEY=iFind_MSISDN and VALUE=".$MSISDN."</P>";
	$VARS=$VARS."&unecpss=".$unecpss;
	//print "Name KEY=enucpss and VALUE=".$unecpss."</P>";
	$VARS=$VARS."&action=both";
	//print "Name KEY=action and VALUE=both</P>";
	$VARS = substr($VARS,1);

Open in new window

0
vrmetro
Asked:
vrmetro
2 Solutions
 
Tyler LaczkoCommented:
You can reference variables in the POST since it is an array

eg Change POST variable

$_POST['keywantingtochange'] = "new value";
0
 
hieloCommented:
>>Now I need to find a specific key in that varable and replace only that.  
if( isset($_POST['keyname']) )
{
$_POST['keyname']="new value";
}
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now