By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,022 Members | 856 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,022 IT Pros & Developers. It's quick & easy.

Cant write code in button click

P: 78
hi
I have a button in my page. I want to write some codes inside that. I use so many methods but shows errors. i have use
Expand|Select|Wrap|Line Numbers
  1. if($_GET['submit']!='')
  2. and
  3. if ($submit)
  4. and
  5. if($_GET['submit']
  6.  
showing errors like
Notice: Undefined index: submit in C:/....
can anybody help to solve this problem?
Jan 27 '12 #1

✓ answered by Dormilich

when you load the page for the first time, you certain have not made a submit, hence the value does not exists and that is the error you get. you need to test, whether the key exists before you can use it.

Expand|Select|Wrap|Line Numbers
  1. if (isset($_GET['submit']))
  2. {
  3.     // there was a submit element
  4. }
note that the submit button is not submitted by every browser (e.g. IE)

Share this Question
Share on Google+
2 Replies


Dormilich
Expert Mod 5K+
P: 8,639
when you load the page for the first time, you certain have not made a submit, hence the value does not exists and that is the error you get. you need to test, whether the key exists before you can use it.

Expand|Select|Wrap|Line Numbers
  1. if (isset($_GET['submit']))
  2. {
  3.     // there was a submit element
  4. }
note that the submit button is not submitted by every browser (e.g. IE)
Jan 27 '12 #2

P: 78
Thank you Dormilich.My problem is solved.
Jan 28 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.