Advertisement

07.29.2003 at 04:14AM PDT, ID: 20693415
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

PHP - Undefined index

Tags: undefined, php, index
Here's an error that I am stuck with, really clueless as to why the error: Notice: Undefined index keep appearing and the line giving the problem is $_GET method or function. I created 2 simple forms. One is called myform.php and the form contains 2 input types, namely firstname and age. Another form is called action.php which prints out the name and age. The form returns error: undefined index when using $_GET["firstname"] but returns no error when using $_POST["firstname"]. Why is this so? I had tried all means to solve the error by setting register_globals = on and reinstalling the web server, mySQL and PHP but the error, undefined index still appears! I am at my wits end. Pls help. Btw, I am using IIS5.0, MySQL 4.0.14 and PHP4.3.2
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: wyan_wee
Solution Provided By: rstorey2079
Participating Experts: 6
Solution Grade: C
Views: 624
Translate:
Loading Advertisement...
07.29.2003 at 08:53AM PDT, ID: 9028951

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.29.2003 at 10:06AM PDT, ID: 9029553

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.30.2003 at 04:35AM PDT, ID: 9035423

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.30.2003 at 04:52AM PDT, ID: 9035486

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.30.2003 at 05:00AM PDT, ID: 9035530

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.30.2003 at 05:38AM PDT, ID: 9035750

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.30.2003 at 05:40AM PDT, ID: 9035766

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
07.31.2003 at 07:49AM PDT, ID: 9042686

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.02.2003 at 07:23PM PDT, ID: 9056531

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
10.13.2003 at 10:24AM PDT, ID: 9541660

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
10.14.2003 at 06:15AM PDT, ID: 9546673

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.27.2005 at 12:29PM PDT, ID: 14097821

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
07.29.2003 at 08:53AM PDT, ID: 9028951
If you could actually show us the code in question we will be able to help. The problem is a little too general to acertain what is going wrong.
 
07.29.2003 at 10:06AM PDT, ID: 9029553

that's the way it has to be.. trying to access $_GET["firstname"] when it doesn't exist generates an error.
either you turn off that error with error_reporting(E_ALL ^ E_NOTICE) at the top, or you FIRST check with isset($_GET["firstname"])
 
07.30.2003 at 04:35AM PDT, ID: 9035423
Hi,

I have tried using isset. This is what I wrote:
$timeout = (isset($_GET["timeout"]) ? $_GET["timeout"] : $_POST["timeout"]);
and I got the error:
Notice: Undefined index: timeout in C:\Applications\Anythink\php_app\logshare\login.php on line 2. I don't know if I had wrote it correctly and also tried writing:
if (isset($_GET["timeout"])
$timeout = $_GET["timeout"];
but I still get the same error.

ThG: I do not quite understand about the error_reporting(E_ALL ^ E_NOTICE) that you mentioned as I an new to PHP. Can you elaborate more?

Thank you


is equal to if  $_post["editmode"] got value then use value in $_post["editmode"] else use value in $_get["editmode"]
 
07.30.2003 at 04:52AM PDT, ID: 9035486
If you are messing around with POSTS and GETS then WHy not use $_REQUEST instead. $_REQUEST contains POST and GET data in the order specified in the variable order configuration. Since the order is generally EGPCS, then POST will overwrite any GET variables.

POST  $x=1, $y=2
GET    $y=3, $z=4

Then REQUEST would have $x=1, $y=2, $z=4 since the POST value of $y overwrites the $y value of GET.


if(!empty($_REQUEST['timeout']))
{
  $timeout=$_REQUEST['timeout'];
}
else
{
  $timeout='default value';
}

empty checks for isset and if the variable is empty ('') or null
 
07.30.2003 at 05:00AM PDT, ID: 9035530
Hi,

As the codes were done by some other programmer previously and it seems that the codes were running fine on his/her pc but  not on mine so I was suspecting if it has got to do with any installation or configuration problem. Furthermore, the project is almost half done so changing or adding these codes would be quite a chore. Are there any other alternatives to it?
 
07.30.2003 at 05:38AM PDT, ID: 9035750
What would be more of a chore, replacing code which doesn't work with code that does (assuming it does) or patching it up?
What setup have you got on your computer, Apache 1.3, PHP4?

Your code is assuming that at least one of these variables is set, try print_r($_POST) to see if you are accessing the variables correctly.

Then try

if(isset($_GET["timeout"])
{
  $timeout=$_GET["timeout"];
}
else
{
  if(isset($_POST["timeout"])
  {
    $timeout=$_POST["timeout"];
  }
  else
  {
    $timeout=default if both dont exist;
  }
}
 
07.30.2003 at 05:40AM PDT, ID: 9035766
sorry just saw IIS5.0, MySQL 4.0.14 and PHP4.3.2, which means you can use $_POST, $_GET etc..
 
07.31.2003 at 07:49AM PDT, ID: 9042686
Hi,

I suspect that there's something wrong with my configuration instead of the codes because the line $existingSession=$HTTP_COOKIE_VARS["SessionData"]; is giving me (Notice: Undefined index: SessionData in C:\Applications\klacks_ass\a3-partb.php on line 113) error as well.

 
08.02.2003 at 07:23PM PDT, ID: 9056531
Check if the form tag look like this : (method="post")

<form name="login" method="post" action="action.php">

About POST and GET
--------------------------

There are two methods that you can use when creating a form in HTML: Post and get as in:
If you don't specify a method, then the Web server assumes that you are using the get method.
What's the deal? They almost do the same thing? hmm .... almost
You may notice that URL looks a lot longer after you submit a form that uses the get method. For example, you may see something like:

http://www.mysite.com/form.php?name=Gerardo&age=25&comment=I+love+PHP

That's because the get method puts the contents of the form right in the URL. There a few disaventages to this. First, there is a limit to how much data you can send through a form using this method, on many systems this limit is 256 characters. Also, the individual get queries may be stored in you web server logs and other people may be able to decipher data sent from your forms that use this method.

The post method was created to correct the inadequacies of the get method. The information send using the post mehod is not visible in the URL, and form data cannot be deciphered by lookin in the Web server logs. There also ins't such a small limint of data that can be send form a form.

I suggest to use the get method just to debug your code.
____________
GeRaRDo
ggerardo@hotmail.com

 
10.13.2003 at 10:24AM PDT, ID: 9541660
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by: waygood

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

us111
EE Cleanup Volunteer
 
10.14.2003 at 06:15AM PDT, ID: 9546673


NOTICE is not a real error.  It is just a warning that you are using an undefined index in an array somewhere.  I would just turn off notices in my php.ini file (set error reporting to all except notices, as someone posted before).  You do not need to change your code.
Accepted Solution
 
05.27.2005 at 12:29PM PDT, ID: 14097821
I found this posting when searching for an answer to a similar problem so I thought I'd tack this on here as well...

To turn off error reporting without changing your php.ini globals, add this to your script:

error_reporting(E_ALL ^ E_NOTICE);
 
 
20080236-EE-VQP-29