Current location: Hot Scripts Forums » Programming Languages » PHP » NOTICE: Undefined index


NOTICE: Undefined index

Reply
  #1 (permalink)  
Old 04-28-05, 04:25 AM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
NOTICE: Undefined index

Hi I got a problem:

I passed a value in the index_type variable from personal_form.php
Here is the code:

<input type=hidden name="index_type" value="Educational Background"; ?>


The user picks the record to be deleted.
The personal_form.php calls the proc_athlete.php

Here is the code:

Code:
if ($_POST['index_type']=="Educational Background")
      {

      if ($process=="add")
         {
           $SQL="INSERT INTO educ_background (StudNo, Years_Inclusive, Degree_Earned, School)
           VALUES ('".$student."','".$yrs_inclusive."','".$deg_earned."', '".$s_chool."')";
         }
      elseif ($process=="edit")
         {
           $SQL= "UPDATE educ_background SET Counter= '$count', StudNo= '$student', years_Inclusive= '$yrs_inclusive', School= '$s_chool' WHERE StudNo= '$student' AND Counter= '$count'";
         }
      elseif ($process=="del")
         {
           $SQL="DELETE FROM educ_background WHERE StudNo='$student'";
         }
      mysql_select_db("apds") or die("Could not select database");
      $result = mysql_query($SQL)or die("Query failed : " . mysql_error());
      include("educ_background_main.php");
      }

The error is:

Notice: Undefined index: index_type in c:\web\apds\proc_athlete.php on line 13

I hope you could give me a tip. Thanks.
Reply With Quote
  #2 (permalink)  
Old 04-28-05, 04:56 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
Code:
<input type=hidden name="index_type" value="Educational Background"; ?>
this is a malformed input tag!
use this instead:
Code:
<input type="hidden" name="index_type" value="Educational Background">
as for the Notice, it's because the hidden field was not found! probably because the tag was not correct..
fix it and see if it works.
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #3 (permalink)  
Old 04-28-05, 05:23 AM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
also u can get the error if ur using a switch i.e. ?page=blah
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #4 (permalink)  
Old 04-28-05, 06:36 PM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Thank you Nevermind for the tip. I'll try it. hope it works.
Reply With Quote
  #5 (permalink)  
Old 04-29-05, 12:31 AM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Hi NeverMind,

I applied what your suggestion but it didn't work either.


any other solution?
Reply With Quote
  #6 (permalink)  
Old 04-29-05, 12:54 AM
weilies weilies is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
i hav try out the code but no prob at all for the code.

most possible problems is the configuration got prob already.
Reply With Quote
  #7 (permalink)  
Old 04-29-05, 04:19 AM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

Check the register_globals setting and also make sure your form has the POST method.
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Index page Help @?%^*# yANIME.net JavaScript 3 02-25-05 06:50 AM
Include problem in C bkbenson C/C++ 4 02-08-05 04:24 AM
Notice: Undefined variable: netbakers PHP 2 01-17-05 08:03 AM
Create an index with Asp.net-vb code kathryn ASP.NET 0 01-04-05 08:39 AM
Link to index (PR5) or the forum (PR6) iKwak HTML/XHTML/XML 0 08-26-04 03:35 AM


All times are GMT -5. The time now is 06:42 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.