Solution to "Notice: Undefined index" PHP error. Official website http://phpacademy.org Support Forum http://phpacademy.org/forum Follow us on Twitter! http://twitter.com/phpacademy More
Solution to "Notice: Undefined index" PHP error. Official website http://phpacademy.org Support Forum http://phpacademy.org/forum Follow us on Twitter! http://twitter.com/phpacademy Less
Added Sep 5, 2011
Channel Education
Duration 9:8 | views 6834
Local Comments 0
Youtube Comments 24
Rating:
Tags php notice error undefined index in on line errors common
Permalink:


Post a comment
Local Comments (0)
Youtube Comments (24)
RaqseeBismil Says:
Mar 20, 2012 - $entity = mysql_fetch_array(mysql_query("SELECT * FROM table_name WHERE id='$id_to_be cloned'"), MYSQL_ASSOC) or die("Could not select original record"); // set the auto-incremented id's value to blank. If you forget this step, nothing will work because we can't have two records with the same id $entity["id"] = "";
RaqseeBismil Says:
Mar 20, 2012 - $entity = mysql_fetch_array(mysql_query("SELECT * FROM table_name WHERE id='$id_to_be cloned'"), MYSQL_ASSOC) or die("Could not select original record"); // set the auto-incremented id's value to blank. If you forget this step, nothing will work because we can't have two records with the same id $entity["id"] = "";
SuperDestroyer1991 Says:
Mar 13, 2012 - The dollar sign worked for me. Thnx for the tip.
XxBlackRockBlankxX Says:
Mar 1, 2012 - can you just put the php code below the html one? coz that's what i do and i found no errors..i think..
PancakePlease Says:
Feb 17, 2012 - whoa did not know you can do isset for multiple variables and separate with commas. In your beginner tutorials on thenewboston, you typed isset for each one. Good thing I saw this video, saves lots of typing. Also good idea on that indentation. Looks much cleaner.
McbainGames Says:
Feb 15, 2012 - That's Cheating! Haha!
EmilsMC Says:
Jan 10, 2012 - I'd just add an @ before the variable :)
RomaineRC Says:
Dec 20, 2011 - You are an absolute don!!!
gervic23 Says:
Nov 26, 2011 - I found other solution, copy and paste this code to your scripts. error_reporting (E_ALL ^ E_NOTICE);
bronzemoontr Says:
Nov 22, 2011 - does anyone know what is the main reason on my site A PHP ERROR WAS ENCOUNTERED Severity: Notice Message: Trying to get property of non-object Filename: project/viewProject.php Line Number: 898
Kyumie Says:
Oct 18, 2011 - Thank you a lot. I have googled a lot and posted on forums but nothing had worked out even from the book itself [thaugh not finished up reading]. Using the tips you gave it helped a lot.
winfr34k Says:
Sep 6, 2011 - Thank you very much, never knew that!
phpacademy Says:
Sep 6, 2011 - The echo construct is loosely regarded as a function, which can take an unlimited amount of parameters. Hence, each string can be separated by a comma.
phpacademy Says:
Sep 6, 2011 - That's true. It's personal preference really. I just feel it's cleaner to specify a hidden value.
strafir Says:
Sep 6, 2011 - I see your point, tho I would have liked if it was even merely mentioned.
phpacademy Says:
Sep 6, 2011 - No! Never do this. It will decrease script performance (load time).
tyoil Says:
Sep 6, 2011 - hi there you don't have to add a hidden field and check for it you could just give the submit button a name like this: input type="submit" value="Submit" name="submit" and then check if the submit button is clicked like this: if (issset($_POST['subbmit']){
strafir Says:
Sep 5, 2011 - another way that wasn't mentioned here is to just mark a '@' before the dollar sign, which will remove the error. For example: if ($_POST['something']) becomes if (@$_POST['something'])
killerbng Says:
Sep 5, 2011 - btw what I mean is right now, if u type something in something_else but not in something...u would still get an error for the something seem as this example has no validation so all fields would be "optional"
killerbng Says:
Sep 5, 2011 - why not do 3 if statements, 1 for something is set, 1 for something_else is set and 1 for if both r set :P most forms have optional fields :P
computertrick Says:
Sep 5, 2011 - You could also turn error reporting off error_reporting(0);
TheEpicNewb Says:
Sep 5, 2011 - I'm not sure either. Hopefully he answers this.
winfr34k Says:
Sep 5, 2011 - since when can you do commas instead of dots for concatenating?
krishnankuta Says:
Sep 5, 2011 - thank you very much to upload this video...i have been getting this error most of the time while do login/registeration page....&others
heydude8999 Says:
Sep 5, 2011 - last