472,971 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,971 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 2677
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.