Solved

Need to find key with value, replace that value

Posted on 2008-09-29
2
229 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
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Trouble parsing soap xml result 3 26
whm high memory usage in processes 7 36
Modify PHP Code on the Fly? 8 39
Creating a slider 12 34
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to count occurrences of each item in an array.
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 …

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now