Hi
I thought I had resolved this problem but I am intermittently
the receving the warnings below.
This code consist of a 1) HTML form, 2) a display function on the HTML form and
3) a process to manage the form input.
Can you show me what I am doing wrong and or how to correct it ?
<b>Message received:</b>
Warning: array_filter() [function.array-filter]:
The first argument should be an array in D:\search_process.php on line 155
Warning: array_filter() [function.array-filter]:
The first argument should be an array in D:\search_process.php on line 156
Warning: array_filter() [function.array-filter]:
The first argument should be an array in D:\search_process.php on line 171
Warning: array_filter() [function.array-filter]:
The first argument should be an array in D:\search_process.php on line 172
<b>Note: I have proveded only a small portion of the related code. </b>
[html]
<!--/**FORM**/-->
{//function start
//for loop start
{
echo"<tr height=\"10\">
<td width=\"4%\" bgcolor=\"#fff8dc\" align=\"center\">
<input type=\"checkbox\" name=\"fee1_choice[$i]\" value=\"$code_id\"></td>
<td width=\"7%\" bgcolor=\"#fff8dc\" ><span class=\"style20\"><strong>$fee1_code</strong></span></td>
<td width=\"3%\" bgcolor=\"$bgcolor\" height=\"10\">
<input type=\"text\" name=\"fee1_unit[$i]\" size=\"1\" maxlength=\"2\" value =\"$fee1_unit\"/>
</td>
<td width=\"79%\" bgcolor=\"$bgcolor\" class=\"style20\"> $description </td>
<td width=\"6%\" align=\"left\">$s_fee</td>\n";
echo"</tr>\n";
}//end of loop
//assign all arrays into single array for the return statement
$all_array = array(fee_choice, fee_unit, fee_money, fee1_choice, fee1_unit, fee1_fee, fee2_choice, fee2_code, fee2_unit, fee2_describe, fee2_money, fee3_choice, fee3_code, fee3_unit, fee3_describe, fee3_money);
//return array from function
return ($all_array);
}//end of function
//unpack returned array
list($fee_choice, $fee_unit, $fee_money, $fee1_choice, $fee1_unit, $fee1_fee, $fee2_choice, $fee2_code, $fee2_unit, $fee2_describe, $fee2_money, $fee3_choice, $fee3_code, $fee3_unit, $fee3_describe, $fee3_money )= $all_array;
[/html]
[php]
<?php
/**PROCESS**/
/**data from form**/
$fee_unit = $_POST['fee_unit'];//array with the number of units
$fee_money = $_POST['fee_money'];//array selected fee
//filter blank indexes
$fee_unit = array_filter($fee_unit); //line 155
$fee_money = array_filter($fee_money); //line 156
/**data from form**/
$fee1_unit = $_POST['fee1_unit'];//array with the number of units
$fee1_money = $_POST['fee1_money'];//array selected fee
//filter blank indexes
$fee1_unit = array_filter($fee1_unit); //line 171
$fee1_money = array_filter($fee1_money);//line 172
/** get array contents for insertion**/
$indices2 = array_keys($code1_id);
foreach($indices2 as $index2)
{
//individual value validation from 3 arrays
$code1_id[$index2];
$fee1_unit[$index2];
$fee1_money[$index2];
//validate unit
$field_unit = $fee1_unit[$index2];//assign field to array for function
check_unit_field($field_unit);//funtion to validate user entered numbers or message sent
//insert statement goes here
}
?>
[/php]
I have added the code below to the process to get rid of
the errors but this creates another problem where the
for loop can't extract the data from the arrays.
[php]
//create array A
$fee_unit = array($fee_unit);
$fee_money = array($fee_money);
//create array B
$fee1_unit = array($fee1_unit);
$fee1_money = array($fee1_money);
[/php]
3 3721
I hope the following code statement is a type\ - $all_array = array(fee_choice, fee_unit, fee_money, fee1_choice, fee1_unit, fee1_fee, fee2_choice, fee2_code, fee2_unit, fee2_describe, fee2_money, fee3_choice, fee3_code, fee3_unit, fee3_describe, fee3_money);
-
if not, what are you addressing here? Not php variables!
Have you printed (print_r($_POST) the POST array to see what is the construction of e.g. $_POST['fee_unit'] ?
Ronald :cool:
I hope the following code statement is a type\ - $all_array = array(fee_choice, fee_unit, fee_money, fee1_choice, fee1_unit, fee1_fee, fee2_choice, fee2_code, fee2_unit, fee2_describe, fee2_money, fee3_choice, fee3_code, fee3_unit, fee3_describe, fee3_money);
-
if not, what are you addressing here? Not php variables!
Have you printed (print_r($_POST) the POST array to see what is the construction of e.g. $_POST['fee_unit'] ?
Ronald :cool:
Hi Ron
Thanks for responding.
I altered the values assigned to $all_array used by the return starement.
This seems to be working and I have not received any error or warning messages yet. Working change
[php]
$all_array = array($fee_choice, $fee_unit, $fee_money, $fee1_choice, $fee1_unit, $fee1_fee, $fee2_choice, $fee2_code, $fee2_unit, $fee2_describe, $fee2_money, $fee3_choice, $fee3_code, $fee3_unit, $fee3_describe, $fee3_money);
[/php]
I think this can be considered resolved, unless you think other wise.
Who marks the discussion as resolved?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alex Vinokur |
last post by:
Various forms of argument passing
=================================
C/C++ Performance Tests
=======================
Using C/C++ Program Perfometer...
|
by: Mark Dicken |
last post by:
Hi All
I have found the following Microsoft Technet 'Q'
Article :-
Q210368 -ACC2000: How to Pass an Array as an Argument to a Procedure
(I've also copied and pasted the whole contents into...
|
by: Uncle |
last post by:
I am an untrained hobbyist. Everything about programming I have learned
from the internet. Thank you all for your gracious support.
This is what I have:
#define CONST_CHAR 0
void some_func(...
|
by: Daniel Rudy |
last post by:
Hello,
I'm trying to learn how command line arguments are handled in C. The
following code segment that I wrote as a test program compiles, but when
I try to run it, it core dumps. This is...
|
by: bowlderster |
last post by:
Hello,all.
I want to get the array size in a function, and the array is an argument of the function.
I try the following code.
/***************************************
*/
#include<stdio.h>...
|
by: virgincita schmidtmann |
last post by:
Good evening,
I would like to pass the size of an array from the commandline.
int main(int argc, int *argv) {
....
max=*argv;
int list;
....
|
by: Klaas Vantournhout |
last post by:
Hi all,
I was wondering if it is possible if you can check in a function if one
of the arguments is temporary.
What I mean is the following. A is a class, foo is a function returning
a class...
|
by: lorlarz |
last post by:
In the code sample below, how are arguments a legitimate
argument to Array.slice?
Function.prototype.bind = function(){
var fn = this, args = Array.prototype.slice.call(arguments), object =...
|
by: mattehz |
last post by:
Hey there,
I am trying to upload old source files and came across these errors:
Warning: Invalid argument supplied for foreach() in /home/mattehz/public_html/acssr/trunk/inc_html.php on line 59...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |