Problem with scope of arrays
Posted: Fri Jul 14, 2006 8:43 am
Pimptastic | Please use
Followed by a combination of php and html code
Further down the file I have
When I run it I get "Notice: Undefined index: Dance_num in ......"
What the heck am I missing I am certain that it is so simple that I am looking straight over
it and I really need to go to bed
Thanks in advance
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
There is something about the scope of variables which I do not understand.
I am running PHP 5.1
I have a file which starts off with some html header information and the first php statements in the file areCode: Select all
<?php
include 'lib.php';
include 'database.php';
$criteria = array( 'Judge', 'Event', 'Level', 'Dance_num' );Further down the file I have
Code: Select all
<?php
$dance_num = $criteria['Dance_num']; // error on this line
echo "<INPUT TYPE=TEXT NAME=\"Dance_num\" value=$dance_num>";
?>What the heck am I missing I am certain that it is so simple that I am looking straight over
it and I really need to go to bed
Thanks in advance
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]