Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




How To Add An Element To The Middle Of An Associative Array ?


I got an array that consists of elements that are arrays also. Now I
wish I could add an element to the middle of it. Let mi give you an
example:

array (
- array(1,15,apple),
- array(2,28,banana),
- array(3,41,orange)
}

I would like to add, let's say, carrot on 2nd position:

array (
- array(1,15,apple),
- array(2,57,carrot),
- array(3,28,banana),
- array(4,41,orange)
}

Array_splice() does not work (or maybe i use it in a wrong way? - it
splits an adding element for, in that case, 3 elements). Array_push()
adds only to the end of an array. can samobody tell me how to add and
element to the middle of an associative array?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Iterate From Middle Of Array
I want to iterate through an array starting at a known index. However the indexes are not linear.

For example I have an array of events keyed by timestamp.

$eventList = array (1064263264 => "event1", 10642635555 => "event2", 1064266666 => "event3", 1064267782 => "event4", 1064268812 =>
"event5");

I basically want to do a "for" or "foreach" but I don't necessarily want to start at key 1064263264 (event1).

I'm looking for something Like

$startEvent = 10642635555;
$endEvent = 1064267782;
for ($event = $startEvent; $event < $lastEvent; $event = nextKey())
{
print $eventList[$event];
}

To make it worse, I can't use a foreach and simply "if" my way out of it because I am already iterating over the entire list and I
would like to avoid a O(x^2) algorithm.

foreach ($eventList as $currentEvent)
{
..... // processing
$startEvent = 10642635555;
$endEvent = 1064267782;
for ($event = $startEvent; $event < $lastEvent; $event = nextKey())
{
print $eventList[$event];
}
..... // more processing
}

Of course there is no "nextKey()" and before rolling my own I thought I would ask if PHP already has a solution for this that I've
missed.

Inserting A Value Into The Middle Of An Array: Is This The Best Way?
I'm trying to insert a value into the middle of a simple
(numerically-ordered) array, and bump all the later array keys up one.
AFAIK, there isn't a function to do this already, so this is the code I
came up with... is this the best way of doing it?

<?php
function array_insert($array, $value, $position)
{
if (is_array($array)) {
$array_out = $array; // so I don't mangle it during foreach
foreach ($array as $key => $val) {
if ($key < $val) { $array_out[$key] = $val; }
else { $array_out[$key+1] = $val; }
}
$array_out[$position] = $value;
return $array_out;
}
return false;
}
?>

Insert Into Middle Of Array
I've read over all of the array functions at php.net. The closest thing to what I'm looking for is array_push(). But I can't figure out how to use push to put data in at a specific point in the array, just the beginning.

I want to insert data in the middle of my arrays while preserving/pushing back all the values behind it:

array(0,1,2,3,4);

insert_into_array at 2(value1,value2,value3)

so then my array is

0,1,2,value1,value2,value3,3,4

How do you do this? I'm feeling befuddled, maybe I should get more sleep (I really don't get enough sleep:()

Inserting Values Into The Middle Of An Array
Is there a built in function or easy way of inserting new values into the middle of an array?

Deleting A Single Item From The Middle Of An Array?
I have an array that contain objects, I want to be able to test against the id of that object and remove it from the array. In it's simplest for I want to go from this:

$people = array('Tom', 'Dick', 'Harriet', 'Brenda', 'Jo');

...to this...

$people = array('Tom', 'Dick', 'Brenda', 'Jo');

The fact that the items in the array are objects should not matter right? Plus I've already written my loops and conditionals to check which item i need to remove.

function removeItem ( $item ) {
   $len = count ( $_SESSION['basket_arr'] ) ;
   if ( $len == 1 ) {
      emptyBasket ( ) ;
   } else {
      for ( $i = 0 ; $i < $len ; $i++ ) {
         if ( $item->id == $_SESSION['basket_arr'][$i]->id ) {
            //$_SESSION['basket_arr'][$i] must go
         } } }}


Using The $value Of An Associative Array
I am using an associative array to populate one field of a form. I use the $key to obtain the numeric value I want to enter into one of my tables. I use the $value to display in nice text what the numeric key represents. I have no problem entering the $key into the table or displaying the $value on the form. My problem is in displaying the results of the processed form to the user:

My form "action" is "processform". In processform I do the INSERT query and return a message to the user. It is in the message to the user where my problem comes in. I've only captured the $key from the form. How can I capture also the $value from the form post, so that when I display to the user what he or she has chosen on the form, the nice text will display rather than the (to them) meaningless id number? Code:

Associative Array
I have to search a db table, and count distinct records to get some results from a survey we've done. The record needs to be echoed along with the number of times it is recorded. Each field in the table has to be searched individually, so that we can see the answers for each question separately.

I thought that I could do this with one query, maybe 'count distinct', but I couldn't get it to show both the value of the row, and the amount of times that value had been recorded.

So, I have to do 2 queries, one getting the distinct values of the field, the other counting how many times they are recorded. Here's the 2 queries: Code:

Associative Array
I have a list of word/number pairs. I need to retrieve the word that has the highest number associated with it.

I have put this list into an associative array...

$array['apple'] = &#3912;'
$array['orange'] = &#393;'
$array['pear'] = &#3950;'

...and ordered it using arsort() so that "pear" in this case is the first value, then hit a brick wall when I realised that echoing $array[0] didn't work on an associative array. Indeed, why would it? :)

Is there a simple way to retrieve the top value after it's sorted, or do you always need to know the name of the key to manipulate associative arrays?

Else, do I need to look into multidimensional arrays? Something like...

$array[0] = array('apple' => &#3912;');
$array[1] = array('orange' => &#393;');
$array[2] = array('pear' => &#3950;');

At which point, I'm not clear on how this would be sorted based on the values of the nested arrays, and how you would then specify to retrieve the key of the nested array of the first key of the original array!

Associative Array In Class
In PHP Version 4.3.6 I am trying get a value from a class member that
is an associative array...

class MyClass
{
$var row;

function MyClass()
{
$this->$row = array("A"=>"Apple", "B"=>"Bob");
echo "One: " . $this->$row["A"] . "<br>";
echo "Two: " . $this->row["A"] . "<br>";
$cache = $this->$row;
echo "Three: " . $cache ["A"] . "<br>";
}
}

But this is the output...

One: Array
Two:
Three: Apple

How can I get at the value of the associative array without making a
local copy first!

Array_push() With An Associative Array?
Is there a way to add a key/value pair to an associative array? I'm tryint to do this, but it dosn't work.

$author = array();
while ($row = mysql_fetch_array($result)){
array_push($author,$row[id],$row[name]);}

Associative Array Question - Newbie
I am in the process of designing (before coding) my first serious PHP/MySQL application and I have a question about the best way to store information.

The application will allow users to view the voting record of different legislators. I have concluded that the most efficient way to store the data is in two tables: one that has details about each legislator (mp) and another that has the details of each piece of legislation (bill). Each legislators record will have a field that holds info in an associative array in the form (bill ID, vote result). This way, when a new piece of legislation is added to the database, one more value pair (bill ID, vote result) will be added to each legislators voting record field.

My question is two part:

Is this the most efficient way to store the data?

and

I suspect I will have to be using regular expressions to extract and format the data from the MySQL query. Are there some PHP or MySQL functions or syntax I would find useful in this process of retrieving the data? Any online tutorials? (mysql_fetch_array appears to create an array out of two fields - not really what I am looking for...) I realize this is a rather vague question, but if you have any suggestions, please let me know.

Make Associative Array Out Of String
I have a string that look something like this:

$string = "weight, kg|1200|width, mm|220|prize|20000";

and I would like it to an associative array and print keys and value:

weight, kg: 1200
width, mm: 220
prize: 20000

(The string above is fetched from a database)

Anyone have any bright ideas how to do it?

Adding Values Onto An Associative Array...
I'm trying to develop a simple class which through the interface you can add elements to an array. The method I have used to add the elements is setContentFields($name, $field_type), I have used an array counter variable to increment the array index each time. To me this seems like a workaround, and I wondered if there was a more elegant way of doing this.

The class is as follows:

Sorting An Associative Array Of Objects By Value?
I'm trying to sort an array of objects within an object. Included is a
dumbed down example so that we can get at the meat of the issue without
worrying about complexity or validation. Basically, Funk is an object that
has a name (string) and a value(int). FunkThis represents an object
containing a list of Funks, with each key corresponding to the name of the
Funk. I want to sort this list by val, but I get a Warning: usort():
Invalid comparison function error when I run the script. Keep in mind that
this is for PHP 4

I'm open to suggestions to getting this to work.

<?php
class Funk {
var $name;
var $val;
function Funk($name,$val) {
$this->name = $name;
$this->val = $val;
}
function getVal() {
return $this->val;
}

function getName() {
return $this->name;
}
}

class FunkThis {
var $list;
function FunkThis() {
$this->list = null;
}
function add($funk) {
$this->list[$funk->getName()] = $funk;
}

function compareFunks($a,$b) {
$aVal = $a->getVal();
$bVal = $b->getVal();
if ($aVal == $bVal) return 0;
if ($aVal $bVal) return 1;
if ($aVal < $bVal) return -1;
}

function sortByFunk() {
$list = $this->list;
$this->list = uasort($list,"compareFunks");
}

function show() {
print_r($this->list);
}
}

$a = new Funk("A",3);
$b = new Funk("B",7);
$c = new Funk("C",1);
$d = new Funk("D",9);
$e = new Funk("E",6);

$funkthat = new FunkThis();

$funkthat->add($a);
$funkthat->add($b);
$funkthat->add($c);
$funkthat->add($d);
$funkthat->add($e);
$funkthat->sortByFunk();
$funkthat->show();
?>

[smarty] Addressing Associative Array
Given this assoc array:

$dtl_array[0]['uom_array'][0][0]='key1'
$dtl_array[0]['uom_array'][0][1]='value1'
$dtl_array[0]['uom_array'][1][0]='key2'
$dtl_array[0]['uom_array'][1][1]='value2'
$dtl_array[1]['uom_array'][0][0]='key3'
$dtl_array[1]['uom_array'][0][1]='value3'
$dtl_array[1]['uom_array'][1][0]='key4'
$dtl_array[1]['uom_array'][1][1]='value4'

$sample->assign("dtl_array",$dtl_array);
$sample->display();

How could I create a combobox out of $dtl_array in the templates?
The following does not work:

<select name="aname">
{section name=mm start=0 loop=$dtl_array.0.uom_array step=1}
<option value="{$dtl_array.0.uom_array.mm.0}">
{$dtl_array.0.uom_array.mm.1}
{/section}
</select>

Values From Form Via Associative Array
I have a form which has a text field and a select box. There are many other fields also in the form . I need get the value of the text field or the select box, depending on which one has a value. Additionally it has to give the value only from the text field even if there is a selection made from the select box. I know that i can get post values from form like this: PHP Code:

Sort An Associative Array Alphabetically
I am working on a product catalog where it displays a product type on a page via the type variable. The products should be displayed alphabetically by $make and $model and i couldn't find any snippets or info other than asort etc. Just curious if anyone else needed such a sort function and how they did it.

ie: product makes Maico, Madsen, Bio-logic etc and their models MA-300, Itera, AC-200. So I would have listings like Maico MA-300, Maico MA-800, Madsen Itera etc., and I need these alphabetical using make and model values. PHP Code:

How To Print A Multidimensional Associative Array?
I have the following associative array:

$user["john"]["mozilla"]=1;
$user["john"]["xmms"]=1;
$user["doe"]["mozilla"]=0;
$user["doe"]["office"]=1;
$user["paul"]["mozilla"]=0;
$user["paul"]["xmms"]=1;
$user["paul"]["office"]=1;

How can I print such an associative array using a loop statement like foreach?

Setting Values In Associative Array To 0
Ive tried almost every combination of while,foreach, key, value ,
array,0 I can some up with

Ive got an associative array that Ive been using as a counter
eg if (blah blah blah )
{$array['beans']++}
elseif (something else){$array['peas']++}
else {$array['carrots']++}

I then want to reset all the values to zero

foreach ($array as $key=>$value)
{ ??????? }
or array_walk ?



XML Formatted String To Associative Array
I'm working on a php socket server for my chat room, and I need to parse some very short XML messages like this:

<msg t="usr"><body a="pubMsg" u="username"><![CDATA[some message]]></body></msg>

Right now I'm using a bunch of substrings (start laughing. lol), but it's very inflexible. However somehow it works...

The problem arises when I try to store user variables (ignore the indents and line brakes, in reality, there will be non of them; we don't want to waste bandwidth)

<msg t="usr">
<body a="updVar" u="username">
<var t="s" n="varname"><![CDATA[some variable]]></var>
<var t="n" n="someNum"><![CDATA[3]]></var>
</body>
</msg>

I have no idea how to parse those stuff from a string to an associative array... What I want is an associative array that I can access those stuff similar to this way:

echo myXML['firstChild']['firstChild']['firstChild']['attributes']['t'];

and it should output "s"

PHP Stops Processing On Multidimensional Associative Array
When using a multidimensional associative array to cross-reference data
in a second, single-dimensional array, PHP stops processing data after
a few iterations. Memory usage according to the task manager doesn't
seem to spike and CPU usage only gets as high as 11 to 13 percent. A
sample script is provided below, any help or alternative solutions are
welcome. (By the way, the script below works fine on Linux with the
same version of Apache and PHP. Possibly a PHP configuration issue?)

Sorting An Associative Multi-Dimensional Array
I would like to sort array below using the last array of a multi-dimensional array. PHP Code:

Printing Out An Associative Array - Whats Wrong?
I have this code segment:

$query = "Select * from Payments order by CustID";
..
.. /* execute the query */
..
if (ora_exec($cursor))
{
$recordset=array();
while (ora_fetch_into($cursor,$recordset,ORA_FETCHINTO_N ULLS|
ORA_FETCHINTO_ASSOC))
{
echo $recordset["CustID"]."<BR>";
echo $recordset["Amount"]."<BR>";
}
}

Gives me the following error
Notice: Undefined index: CustID
Notice: Undefined index: Amount

The table Payments has only CustID and Amount as attributes. is my
usage of the array offset incorrect?

Complex Associative Array To XML FIle And Back
We're using php 4.1 and it doesn't seem to have built in support for
this. Coming from a dotnet background this surprised me...Anyways,
thats a different topic altogether...

I'm looking for a php class that can allow me to save a complex
associative array as an xml file on our server and also be able to read
in back into a complex array when needed. (you'll find an example of
the array below). Because of the complexity if the array, I feel it
would be easier to use this method as opposed to saving to a db.

I know i could write a class to do it, but I'm trying not to reinvent
the wheel. Googleing only refers me to extentions like pear which I
dont want. And I 'm sure someone else has had to do this before.

//ARRAY EXAMPLE ...

ODBC: Fetch Results As Associative Array
Will PHP fetch the results of a query using ODBC as an associative array? I know that MySQL does that, but I couldn't find it for ODBC connections.

POST (or GET) Associative Array To Script From Form
Actually thought I understood this but I can't seem to make it happen this morning, and I can't seem to find a clear simple reference here.

Can I pass an associative array from a form (using either POST or GET) to a .php script all at once, in one simple step?

ie. Say I have the following variable/associative array

$graphtable = Array ( [TESTPHASE] => G085 [GRADE] => 3 [0_LE_1_A] => 0 [1_LE_1_A] => 7 [2_LE_1_A] => 28 [3_LE_1_A] => 22 [4_LE_1_A] => 7 [null_LE_1_A] => 0 [PROTOCOLS] => 64 )

And I pass it as a hidden variable in the following form: ....

Does An Array Contain An Element?
I'm using PHP 4.4.4. Is there a shorter way to check if an array has
an element besides doing a for loop and iterating through each element?

Is The Element Of An Array The Last One ?
What is the best way to solve the next problem: PHP Code:

Getting Element Only Once In Array
I've got an array like so: 1,1,5 But I want to try and make it so if it has the ID appearing more than once then it won't be in the array multiple times. i.e. I want the above to say 1,5.

How To Get Array Element?
get_the_category() returns an array that looks like this:

ResourceArray ( [0] =stdClass Object ( [cat_ID] =3 [cat_name] =>
Certifications [category_nicename] =ms-certifications
[category_description] =Certification Resource [category_parent] =0
[category_count] =5 [fullpath] =/ms-certifications ) )

I want to get the value in "category_description" and have tried:

$category = get_the_category();
$cat_d = $category->category_description;
print_r($cat_d);

But that doesn't print anything. What is the correct way to get the
value I'm after?

Array Element
I am having trouble getting a weather sticker php script to work properly. I have been working with the guys that wrote it, but so far they haven't come up with a solution. They/we have narrowed it down to the section of the script that compares a text string (which has been converted into UPPER CASE) from a file generated by the weather station, with an array. It is supposed to match an index in the array, that points to which graphic file to generate. This works about 30% of the time.

(When the text string is VERY SIMPLE - like CLOUDY or CLEAR or RAIN) But not when the text string is more complex, like HEAVY RAIN, MIST OVERCAST, LIGHT RAIN or PARTLY CLOUDY.

Here is the line that defines one of the elements in the array:

Quote $vws_icon["PARTLY|MOSTLY+CLOUDY|SUNNY+THUNDERSTORM"] = "./icons/" . "$daynight" . "_tstorm.$image_format";

I did not incluse the whole script, nor the whole array because of its length.

My Question (Finally...) is --- in the line above within the square braces, he has enclosed a string in double quotes, but the string is delimited by | characters and + characters. Can someone explain to me in English what this means? I have tried reading through two big reference books on php arrays, and they only made me even less certain. (For example: "the line means - If the string is PARTLY or MOSTLY CLOUDY or SUNNY and THUNDERSTORM, then set $vws_icon to whtever the $daynight._tstorm.$image_format evaluates to.)

I know, my example translation makes NO SENSE in English. Maybe it makes no sense in php either? I think what he's trying to ask is "If the string contains 'THUNDERSTORM' and any of these other words, then generate the correct icon file for thunderstorm".

Delete Array Element
How can i delete an element from one array. Let us suppose that i've an array of 10 elements $a[0], $a[1], $a[2]...etc
And when i delete $a[2] i wanna the elements to be re-ordered like this
$a[0] will be the same $a[0]
$a[1] will be the same $a[1]
but $a[2] will be the $a[3] element i had before deleting $a[2]

It would be called in Delphi, HOW TO DELETE AN ELEMENT FROM A COLLECTION? Is this possible? Have i to use another type of data?
Hope you've understood the idea.

Deleting An Element In An Array??
Here is the problem:

I've got an array with the following elements

$array = ("ice","ice","polka","skate","polka");

thats 2 polka, 2 ice and 1 skate

Now i want someway of removing just one of the polka's from it..

so that i'd be left with:
$array = ("ice","ice","skate","polka");

what i did was a basic search with for loop and break

Code: for($x=0;$x<sizeof($array);$x++)
{
if($array[$x] == "polka")
{
echo("match ".$x);
break;
}
} alls well n good till now.. now i've got the index value(2 in this case) of the element which needs to be deleted.. but what should be done now?? is there any function which'll let me delete a particular element in an array?

Is there any other way to go around this?

Deleting An Element From An Array
I'm not being an idiot here and missing something very obvious as I seem to be prone to doing.

I have the following code:

Editing An Element Within An Array
I have a two-dimensional array that looks like this:
array(
array(0, 123),
array(0, 234),
array(0, 345),
array(0, 456)
)
I want to REMOVE any element that contains 234, and I want to
INCREMENT the first value for any element that contains 345, to make
it look like this:
array(
array(0, 123),...

How To Substract An Element From An Array
I'm looking for a function which substracts an element from an array. For example,

$array = array ("green", "red", "blue", "grey" );

array_substract($array, "red" );

now it's like I had :

$array = array ("green", "blue", "grey" );

notice that the order should be preserved!

Missing Array Element
I am trying to store the id's for 3 hotel rooms into an array called
$rooms, using a simple mysql select statement. Here is the code:

<?php require_once('Connections/Vita_Italiano.php'); ?>
<?php mysql_select_db($database_Vita_Italiano, $Vita_Italiano);
$query_rsAllRooms = "SELECT * FROM room";

$rsAllRooms = mysql_query($query_rsAllRooms, $Vita_Italiano) or
die(mysql_error());

$row_rsAllRooms = mysql_fetch_assoc($rsAllRooms);
$totalRows_rsAllRooms = mysql_num_rows($rsAllRooms);

// create array of all rooms
while ($row_rsAllRooms = mysql_fetch_assoc($rsAllRooms))
{
$rooms[]= $row_rsAllRooms['Room_Number'];
}

?>

When I use <?php print_r($rooms);?> to display the contents of the
variable, the array only contains 2 room numbers, instead of 3. These
are stored in $rooms[0] and $rooms[1].

Does anyone have any ideas what is going on here?

Missing Element In Array?!
I have the following query I run to pull some data from the db. The
sql (when run on the db) returns 2 elements. However, if I var dump my
variable ($aidlook) then the first element in the array does not show
up.

$getaid = mysql_query("SELECT a_uid FROM `answers` WHERE `qid` =
$qid", $db);
$aidlook = mysql_fetch_array($getaid,MYSQL_NUM);

Doing a var dump returns: array(1) { [0]= string(1) "4" }

I should be getting 2 elements (4 and 5).

I am totally baffled. code as follows:

*********************
if (!is_array($aidlook)) $aidlook = array($aidlook); // Check for the
existence of the array in case of null returns

if (!in_array($userid,$aidlook)) // Look for our element which in
this case is "5"
{
if ($qstatus === 1) // Do a status check
{
}

answer_box($qid,$answ); // additional function being run

} else
{
echo "Your Text Here";

}
}

Deleting An Element Of An Array?
How can I delete an Element of an array? Consider the following Example: PHP Code:

Eliminate An Element Of An Array
I want to eliminate the last element of an array, couse when I print it, it doesn´t have any value. I tried to use array_pop but it doesn´t work.

Deleting An Element From An Array
is there some handy and short method to delete an element from an array and than shifting the rest of elements one place ahead
e.g

array(1,2,3,4,5,6)
becomes
array(1,2,4,5,6)

Remove Element From Array
How do I remove an element from an array? Here is my current code:

$sql = mysql_query("SELECT suitenos FROM gssettings WHERE id=1");
$row = mysql_fetch_assoc($sql);
$suites = split(",",$row['suitenos']);
$number_of_suites = count($suites);
for($i=0;$i<$number_of_suites;$i++)
{
if($suiteno == $suites[$i])
{
$selected = "SELECTED";
} else {
$selected = "";
}

echo<<<endhtml
<option value="$suites[$i]" $selected>$suites[$i]</option>
endhtml;
}

Now I have another table in my database called "gsdays" that holds values of suite numbers that are already booked. What I want to do is remove any suite numbers that are already booked from my $suites array. To get the booked suites, I would do the following query.

$query = mysql_query("SELECT suite FROM gsdays WHERE date='2007-03-24'");
$row = mysql_fetch_assoc($query);

$booked_suites = $row['suite'];

so basically what I want to do is remove $booked_suites from $suites. I tried using array_splice but I don't know what I'm doing.

Random Element From An Array
seems simple enough, but not as much as rand($ARRAY); how would i select a random element from an array?

ie $User_Prize = rand($Users);

Check If An Element Exist Within An Array
I thought there must be a simple function that checks if an element exist within an array. I can't find it anywhere... does anybody know?

How To Control Which Element Of An Array Is Printed
Anyone know how to control which element of an array is printed, say from 1-4 then 5-9 etc.

Removing Element From Array Using String
I am trying the following based on an example from php.net

<?php

$array_of_items = array ('A','B','C','D');
array_splice($array_of_items, 'B', 1);

foreach ($array_of_items as $array_of_items2)
{
Print $array_of_items2;}?>

I expect the result to be ACD, I am getting BCD, Not sure why.

Insert An Element In Numbered Array
I need to do the following:

Say I have a multidim array:

$array = array();

$array[0]['name'] = 'Kevin'
$array[0]['age'] = 23;

$array[1]['name'] = 'Julia'
$array[1]['age'] = 31;

$array[2]['name'] = 'Bob'
$array[2]['age'] = 26;

$array[3]['name'] = 'Drew'
$array[3]['age'] = 37;

and I have a seperate array:

$person = array();
$person['name'] = 'Dana'
$person['age'] = 33;

now I want to insert the $person array into the $array in such a way
that it ends up at index 1 and the subsequent elements get pushed up and
renumbered, so $array[1] becomes $array[2] and so on.

Does php have a built-in function that does this?

Changing A Value Of An Element In A Two Dimensional Array
I am having a problem with array manipulation.

in my php script i am reading from a csv file.
the content of file is like this:

Removing An Element From The POST Array
I have a form that is posting it data to PHP_SELF. This then gets processed and does it's thing. My question is that when I hit the submit button, I get all the data from my form but I also get one item from the Submit button itself. Can I make the submit button not include itself in the POST?

Here is an example output of print_r($_POST)
Array
(
    [ACPlatSearch] => -1
    [ACDeedSearch] => -1
    [ACUserInfo] => -1
    [ACPropertySearch] => -1
    [ACStatsTotalSales] => -1
    [SavePermissions] => Save
)

The last element is the submit button, the other ones are checkboxes.  I don't want that last one.  So is there a simple way to not include it or do I need to loop through the array and remove it manually?  I need the rest of the array intact for further processing with array functions.


Copyright © 2005-08 www.BigResource.com, All rights reserved