473,386 Members | 1,621 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,386 software developers and data experts.

Problem with select...

I've got a form with a select list:
<select name="$dane[$idhotelu][$pomocnicza][$k]">;

After "submit"
$_POST['$dane'][$idhotelu][$pomocnicza][$k] contains the selected value -
Am I right??

I have a problem ith this code:

echo"<select name=\"\$dane[$idhotelu][$pomocnicza][$k]\">";

for($i=0;$i<=$nrooms;$i++)
{
echo "<option value=\"$i\"";
if($POST['$dane'][$idhotelu][$pomocnicza][$k]==$i){
echo" selected>$i</option>\n";
}
else {
echo">$i</option>\n";
}//endif
}//endfor
echo"</select>";

Even if I do something like this:
$dane[1][$pomocnicza][0]=1

This seems to be true for $i=0:
if($POST['$dane'][1][$pomocnicza][0]==$i){

"if" condition is true for $i=0 I have no idea why...
Is it because after submit form is reloaded?

What i wanted to get is that if user select "1" from dropdown list then
after reloading this form "1" will be selected value...

Thank for any ideas.

Leszek

Feb 1 '06 #1
2 1217
Check the $_POST array
with
print_r($_POST)
at the begin of the script

after the submitting a form the $_POST array is always available
--

gr. Olaf
PHP classes and scripts: http://www.finalwebsites.com

Feb 2 '06 #2

"Leszek" <le*******@poczta.onet.pl> wrote in message
news:dr**********@news.onet.pl...
I've got a form with a select list:
<select name="$dane[$idhotelu][$pomocnicza][$k]">;

After "submit"
$_POST['$dane'][$idhotelu][$pomocnicza][$k] contains the selected value -
Am I right??

I have a problem ith this code:

echo"<select name=\"\$dane[$idhotelu][$pomocnicza][$k]\">";
get rid of the whole array thing and try using test[] instead. That is what
I have seen done before. I haven't seen any documentation that shows what
the behavior is for multidimensional arrays on a form element. only
suggestion in documentation is to use name[].

for($i=0;$i<=$nrooms;$i++)
haven't I seen this one before? shouldn't that be < instead of <= ?
{
echo "<option value=\"$i\"";
if($POST['$dane'][$idhotelu][$pomocnicza][$k]==$i){
echo" selected>$i</option>\n";
}
else {
echo">$i</option>\n";
}//endif
}//endfor
echo"</select>";

Even if I do something like this:
$dane[1][$pomocnicza][0]=1

This seems to be true for $i=0:
if($POST['$dane'][1][$pomocnicza][0]==$i){

"if" condition is true for $i=0 I have no idea why...
Is it because after submit form is reloaded?

What i wanted to get is that if user select "1" from dropdown list then
after reloading this form "1" will be selected value...

Thank for any ideas.

Leszek

Feb 12 '06 #3

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

Similar topics

2
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only...
5
by: Clifford W. Racz | last post by:
Has anyone solved the issue of translating lists in Word 2003 (WordML) into xHTML? I have been trying to get the nested table code for my XSLT to work for a while now, with no way to get the...
5
by: Nick Shaw | last post by:
Hi, I'm trying to put my resume on my website, and I want to do it using XML and XSL. If I don't include the schema in the mix, the xml displays without a problem. When I add the schema...
3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
8
by: mytfein | last post by:
Hi Everyone, Background: Another department intends to ftp a .txt file from the mainframe, for me to process. The objective is to write a vb script that would be scheduled to run daily to...
2
by: Chris Plowman | last post by:
Hi all, I was wondering if anyone can help me with a really annoying problem I have been having. I made a derived datagrid class that will select the row when a user clicks anywhere on a cell...
20
by: Development - multi.art.studio | last post by:
Hello everyone, i just upgraded my old postgres-database from version 7.1 to 7.4.2. i dumped out my 7.1 database (with pg_dump from 7.1) as an sql-file with copy-commands and to one file using...
4
by: Christofer Dutz | last post by:
Hi, I am having a small problem, that is driving me nuts. My application reads some Xml and runs 2 Xsl Transformations to generate HTML. As soon as my second XSL introduces some <br/tags, the...
2
by: Ravi Joshi | last post by:
The menu on my site works fine in IE6 and Firefox. In IE7, there is a problem with the menu: when you mouse over the various main catagories, the sub-catagories all appear to the right as they...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
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
Oralloy
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,...
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.