473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problem z przeslaniem tablicy do funkcji

Witam.

Napisalem formularz korzystajac z php. W formularzu uzywam tablicy o nazwie
$daneres. Tablica jest trojwymiarowa

Napisalem funkcje javascript:

function verify_res(dane1,dane2){
// cialo funkcji
}

Chcialem ja wywolac z argumentami w naglowku formularza:
<form name="rezerwacja" action="rezerwacja.php" method="post"
onsubmit="return
verify_res($daneres['fchoice'][$pomocnicza],$daneres['schoice'][$pomocnicza])">

Ale otrzymuje blad:

Brak definicji $daneres

Czy blad ten wynika stad ze tablica $daneres jest definiowana wewnatrz
formularza wiec ponizej naglowka?

Jest jakis sposob na rozwiazanie tego problemu?

Pozdrawiam.
Leszek

Feb 3 '06 #1
2 2626
Hej.
Przedeszystkim na tym forum obowiazuje jezyk angielski no ale
mniejsza o to...

Po pierwsze umieszczaj caly (kompletny) przyklad, który mozna
uruchomic a przynajmniej zrozumiec.

Twój problem wynika z tego iz funkcja verify_res(dane1,dane2) jest
funkcja wykonywana
po wcisnieciu przycisku <input type="submit"....>, czyli skrypt
napisany w PHP podczas wciskania tego przycisku sie juz dawno
wykonal... aby przekazac tablice do metody
javascript najlepiej ja "wydrukowac", tak ze np. po wykonaniu sie
skryptu PHP (czyli po wyswietleniu sie strony) funkcja verify_res()
dostawala zrozumiale parametry... Moze to
wygladac mniej wiecej tak (po wykonaniu sie skryptu PHP):

....
<form name="rezerwacja" action="rezerwacja.php" method="post"
onsubmit="return
verify_res(["wartosc1", "wartosc2"] , ["wartosc3",
"wartosc4"])">
....

Roziwiazanie bedzie polegalo na napisaniu cos w stylu:
?>
<form name="rezerwacja" action="rezerwacja.php" method="post"
onsubmit="return
verify_res(
<?php

print("[");
foreach($daneres['fchoice'][$pomocnicza] as $klucz => $wartosc){
print($wartosc);
}
print("]");

?>
,
<?php

print("[");
foreach($daneres['schoice'][$pomocnicza] as $klucz => $wartosc){
print($wartosc);
}
print("[");

?>
">

Moglem tez cos zle zrozumiec ale napisz tez jak rozwiazales
ten problem...

Best Regards
Luke Matuszewski

Feb 5 '06 #2
Zapomniałem o przecinku:

Luke Matuszewski napisał(a):
<form name="rezerwacja" action="rezerwacja.php" method="post"
onsubmit="return
verify_res(["wartosc1", "wartosc2"] , ["wartosc3",
"wartosc4"])">
...

Roziwiazanie bedzie polegalo na napisaniu cos w stylu:
?>
<form name="rezerwacja" action="rezerwacja.php" method="post"
onsubmit="return
verify_res(
<?php

print("[");
foreach($daneres['fchoice'][$pomocnicza] as $klucz => $wartosc){
print($wartosc);
print(",");
}
print("]");

?>
,
<?php

print("[");
foreach($daneres['schoice'][$pomocnicza] as $klucz => $wartosc){
print($wartosc);
print(",");
}
print("[");

?>
">

Moglem tez cos zle zrozumiec ale napisz tez jak rozwiazales
ten problem...

Best Regards
Luke Matuszewski


Feb 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
11
by: Kostatus | last post by:
I have a virtual function in a base class, which is then overwritten by a function of the same name in a publically derived class. When I call the function using a pointer to the derived class...
0
by: Refky Wahib | last post by:
Hi I need Technical Support I finished a Great project using .Net and SQL Server and .Net Mobile Control My Business case is to implement this Program to accept about 1 Million concurrent...
9
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application...
117
by: Peter Olcott | last post by:
www.halting-problem.com
17
by: Jon Slaughter | last post by:
I'm having a little trouble understanding what the slicing problem is. In B.S.'s C++ PL3rdEd he says "Becayse the Employee copy functions do not know anything about Managers, only the Employee...
0
by: James Griffiths | last post by:
Here is a report I've written about a printing problem that is being experienced by a particular company for whom I had developed a A97 system. After upgrading to Win XP and AXP, some printing...
18
by: Ian Stanley | last post by:
Hi, Continuing my strcat segmentation fault posting- I have a problem which occurs when appending two sting literals using strcat. I have tried to fix it by writing my own function that does the...
6
by: s_4 | last post by:
Hello! Sorry about my english - I write to you from poland. I have strange problem. Bind() return '16'. Documentation say that it should return 0 (no error) or -1 (some error). Here is the code...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.