Hey gurus. I just installed WAMP on my PC and I tried accessing my designs on localhost but I get notices like: Undefined index: user in C:\wamp\www\DemoADResources\index.php on line 297 and my line 297 looks like this: <name="user" type="text" value="<?=$_POST['user'];?>" size="20"> these notices stops the script from executing. What do I do to go around these errors?
Getting these errors with WAMP server
Started by talk2toyin, Feb 22 2013 07:34 PM
8 replies to this topic
#1
Posted 22 February 2013 - 07:34 PM
#2
Posted 22 February 2013 - 07:46 PM
Notices do not stop your script from executing. They point out problems in your code.
You're trying to use variables that aren't set yet. In this case, array indices, most likely from $_POST.
You're trying to use variables that aren't set yet. In this case, array indices, most likely from $_POST.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
#3
Posted 22 February 2013 - 07:51 PM
I was just trying to echo the user input should error(s) occur during submission. How do I go about it?
#4
Posted 22 February 2013 - 07:58 PM
The manuals I learned with doesn't say how to go around this, didn't mention it at all
#5
Posted 22 February 2013 - 08:03 PM
You need to check if the value isset() first.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
#6
Posted 22 February 2013 - 08:07 PM
You mean something like: if( isset( $_POST['user'] ) ) { $user = $_POST['user']; }
#7
Posted 22 February 2013 - 08:10 PM
Well that would work if you either give $user a default value as well or check if IT is set before using it.
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq
Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!
#8
Posted 22 February 2013 - 08:15 PM
Thanks a lot. Trying it out right now
#9
Posted 22 February 2013 - 08:40 PM
It really did the magic. Thanks for the help
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












