Jump to content


Photo

Getting these errors with WAMP server


  • Please log in to reply
8 replies to this topic

#1 talk2toyin

talk2toyin

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 22 February 2013 - 07:34 PM

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?

#2 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

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.
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!!

#3 talk2toyin

talk2toyin

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

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 talk2toyin

talk2toyin

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

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 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

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!!

#6 talk2toyin

talk2toyin

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 22 February 2013 - 08:07 PM

You mean something like: if( isset( $_POST['user'] ) ) { $user = $_POST['user']; }

#7 Jessica

Jessica

    This is not my name.

  • Gurus
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

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!!

#8 talk2toyin

talk2toyin

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

Posted 22 February 2013 - 08:15 PM

Thanks a lot. Trying it out right now

#9 talk2toyin

talk2toyin

    Advanced Member

  • Members
  • PipPipPip
  • 48 posts

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

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com