array match problem
Posted: Sat Jun 07, 2008 1:01 am
Hi,
I'm using a form to create an array and need to pass array to PHP to check if there is a matching field.
if($_POST['add']) {
...
$apple= $_POST['xxx'];
$oranges= $_POST['yyy'];
I create an array
$myarray = array("first => $apple","second => $oranges");
I read a file that contains similar entries as $myarray.
$row = 1;
$handle = fopen("file","r");
while(($data = fgetcsv($handle, 1000, " = ")) !== FALSE) {
...
I need to search through this array and alert if there's a match.
eg. if "$apple" exists in the file and also in $myarray.
I'm using foreach($myarray as $k => $v) {
...
but it looks like I get a value that is a concatenation of array elements not separated.
eg. first $apple second $oranges
How can I do this, please help.
I'm using a form to create an array and need to pass array to PHP to check if there is a matching field.
if($_POST['add']) {
...
$apple= $_POST['xxx'];
$oranges= $_POST['yyy'];
I create an array
$myarray = array("first => $apple","second => $oranges");
I read a file that contains similar entries as $myarray.
$row = 1;
$handle = fopen("file","r");
while(($data = fgetcsv($handle, 1000, " = ")) !== FALSE) {
...
I need to search through this array and alert if there's a match.
eg. if "$apple" exists in the file and also in $myarray.
I'm using foreach($myarray as $k => $v) {
...
but it looks like I get a value that is a concatenation of array elements not separated.
eg. first $apple second $oranges
How can I do this, please help.