Solved

Need to find key with value, replace that value

Posted on 2008-09-29
2
234 Views
Last Modified: 2008-09-29
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
Comment
Question by:vrmetro
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Assisted Solution

by:Tyler Laczko
Tyler Laczko earned 200 total points
ID: 22598055
You can reference variables in the POST since it is an array

eg Change POST variable

$_POST['keywantingtochange'] = "new value";
0
 
LVL 82

Accepted Solution

by:
hielo earned 300 total points
ID: 22598069
>>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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question