473,386 Members | 1,773 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.

Why wont this access an array???

Can someone please tell me how to access elements from a multiple
selection list? From what ive read on other posts, this is correct. I
keep getting an "Undefined variable" error though...

Form page********************************************** **************
<form action="/process.php" method="get" name="formOne" id="formOne">
<select name="owner[]" size="6" multiple id="owner[]">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select>
<input type="submit" name="Submit" value="Submit">
</form>
Process page********************************************** ************
for($i=0; $i < count($owner); $i++) {
echo $owner[$i];
}

Thanks! -Nick
Jul 16 '05 #1
2 2704
Nick wrote:
Process page********************************************** ************
for($i=0; $i < count($owner); $i++) {
echo $owner[$i];
}

Thanks! -Nick


replace echo $owner[$i];

with

echo $_GET["owner"][$i];

- Marcus
Jul 16 '05 #2
Nick wrote:
Can someone please tell me how to access elements from a multiple
selection list? From what ive read on other posts, this is correct. I
keep getting an "Undefined variable" error though...

Form page********************************************** **************
<form action="/process.php" method="get" name="formOne" id="formOne">
<select name="owner[]" size="6" multiple id="owner[]">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select>
<input type="submit" name="Submit" value="Submit">
</form> Process page********************************************** ************
for($i=0; $i < count($owner); $i++) {
echo $owner[$i];
}


Just a hunch... Have you defined the variable $owner? If not, you are
probably depending on register_globals to being "on", which it may not
be in your system. Try using the following:
$owner = $_GET["owner"];
before your for... loop.

HTH
--
Marius

Jul 16 '05 #3

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

Similar topics

4
by: Steve Westwood | last post by:
I have a WebForm button. Depending on calculation I wont to send a popup message to the web page. I am not sure of the approach. From the server side code I don't seem to be able to access the...
4
by: ben | last post by:
Hi Im gettting run time error (Unhandled exeption, access violations) when executing the following code: #include <conio.h> #include <stdio.h> #include <ctype.h> #include <string>...
7
by: Christine | last post by:
My code has a split function that should split the text file of numbers. I've run this in previous programs as it is here and it worked, but now it wont work for some reason and returns...
2
by: Grant | last post by:
Why wont this SQL query work? I am connecting to an Access database and when using 'mySelectQuery1' it returns a datareader but when using 'mySelectQuery2' it returns nothing...I can run this query...
5
by: manokumar | last post by:
hiye, i notice that some if not all of my folders in winxp pro. are set as read only and its giving me some problem with development. so as the natural thing, i unchecked the read only option and...
7
by: dhnriverside | last post by:
Hi guys I've got a web application on a Win2k IIS5 server. I've been coding it using anonymous access, and have just come to test the AD stuff - trouble is - all i get is a 402.1 error ("not...
3
by: Brian Henry | last post by:
every time i try to run my asp.net 2.0 app it says Server Application Unavailable The web application you are attempting to access on this web server is currently unavailable. Please hit the...
1
by: Diz | last post by:
Hi, Can anybody tell me why my php script wont run properly unless i put it in a page all on its own? Is it antisocial? Does it want to be alone? I have put it in a page with background and links to...
0
by: leon70 | last post by:
Hi Group, I built a gSoap 2.7.11 Web services client in C++ on AIX and have got it talking to the remote service. The service is sending back an array of objects to my client but the client is...
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
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
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
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.