talk2toyin Posted February 23, 2013 Share Posted February 23, 2013 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? Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 23, 2013 Share Posted February 23, 2013 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. Quote Link to comment Share on other sites More sharing options...
talk2toyin Posted February 23, 2013 Author Share Posted February 23, 2013 I was just trying to echo the user input should error(s) occur during submission. How do I go about it? Quote Link to comment Share on other sites More sharing options...
talk2toyin Posted February 23, 2013 Author Share Posted February 23, 2013 The manuals I learned with doesn't say how to go around this, didn't mention it at all Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 23, 2013 Share Posted February 23, 2013 You need to check if the value isset() first. Quote Link to comment Share on other sites More sharing options...
talk2toyin Posted February 23, 2013 Author Share Posted February 23, 2013 You mean something like: if( isset( $_POST['user'] ) ) { $user = $_POST['user']; } Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 23, 2013 Share Posted February 23, 2013 Well that would work if you either give $user a default value as well or check if IT is set before using it. Quote Link to comment Share on other sites More sharing options...
talk2toyin Posted February 23, 2013 Author Share Posted February 23, 2013 Thanks a lot. Trying it out right now Quote Link to comment Share on other sites More sharing options...
talk2toyin Posted February 23, 2013 Author Share Posted February 23, 2013 It really did the magic. Thanks for the help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.