473,387 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Notice: Undefined index:..

Hi all i am new here!
I take a look on forum but i don't found a the answer for my problem
ok this is my problem:


Notice: Undefined index: name in C:\wamp\www\register.php on line 47

Notice: Undefined index: code in C:\wamp\www\register.php on line 48

Notice: Undefined index: title in C:\wamp\www\register.php on line 49

Notice: Undefined index: name in C:\wamp\www\register.php on line 99
Expand|Select|Wrap|Line Numbers
  1. Line47:$user = $_GET['name'];
  2. Line48:$pass = $_GET['code'];
  3. Line49:$char = $_GET['title'];
  4. Line99:if ( $_GET['name'] <> "" )
  5. {
  6.  
  7.  if(file_exists("C:\\Documents and Settings\\User1\\Desktop\\Accounts\\$user.ini"))
  8.  {
  9.  
  10.     echo '<span style="font-weight: bold;">Account already in use!</span>';
  11.  }
  12.  else
  13.  {
  14.      $handle = fopen ( "C:\\Documents and Settings\\User1\\Desktop\\Accounts\\$user.ini", "a+" );
  15.     fwrite ( $handle, $data );
  16. fclose ( $handle );
  17.  
  18.     echo '<span style="font-weight: bold;">Account sccefuly created!</span>';
  19.     echo ' </br> <a href="javascript:history.back()">Back</a>';
  20.  
  21.     exit; 
  22.  
  23. a alittle mor from line 99 :P 
  24. Detail: I have this code in same page with form :|
  25.  Form: 
  26. <form action="register.php" method=GET enctype="multipart" >
  27.       <p><span style="font-weight: bold;">Username:</span><br>
  28.       <input type="Text" name="name" >
  29.       </p>
  30.  
  31.       <p><span style="font-weight: bold;">Password:</span><br>
  32.       <input type="password" name="code" ></p>
  33.  
  34.       <p><span style="font-weight: bold;">CharName:</span><br>
  35.       <input type="text" name="title" ></p>
  36.   <input type="Submit" name="" value="Register"></form>
May 16 '10 #1
3 5961
phobia
5
The notices are issued because you're trying to access indexes not currently set in the $_GET variable. Most likely because the form hasn't been submitted, so you should probably create a check for that, but one way to define a default value for the variables is by using ternary statements:
Expand|Select|Wrap|Line Numbers
  1. $user = (isset($_GET['user'])) ? $_GET['user'] : '';
Here the $user variable will be set to the contents of $_GET['user'] if that is set, otherwise to '' (blank).
May 16 '10 #2
Hi , i have a same above proublem. but the proublem of mine it's giving me ablank page.
i hope u help me too
Jul 18 '10 #3
TheServant
1,168 Expert 1GB
@manee1982
When you say a blank page what do you mean? This one recorded some PHP errors, are you saying you have no errors, just a blank page? If so, how do you know your problem is the same? Did you try the solution?
Jul 19 '10 #4

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

Similar topics

3
by: sam | last post by:
HI, I installed php4 for apached and restart apache afterward. but my little php script generated error followint error: PHP Notice: Undefined index: myname in...
1
by: Hal Halloway | last post by:
How do I fix this error message below? Thanks. Notice: Undefined index: key_word in C:\Program Files\Apache Group\Apache2\htdocs\search010.php on line 55 .... if( $_GET ) { // line 55 //...
12
by: bb nicole | last post by:
I have do a update profile for company where they can update after view their profile, but it cannot function... I need to submit the whole job portal soon, but still got many problem in my coding,...
6
by: jsgoodrich | last post by:
I am looking for some help if anyone can lend a hand. I have a simple php website that displays a table from my mysql database. To prep for my MCSE I moved my home server to Windows 2003...
3
by: number1yan | last post by:
Can anyone help me, i am creating a website and am using a php script that recomends the website to other people. I keep getting the same error and can not work out why. The error is: Notice:...
3
by: sickboy | last post by:
$channels=$_GET; if (empty($channels)) { $channels='blank'; } changechannels($channels); $theatre=$_GET; if (empty($theatre)) { $theatre='splash'; } changetheatre($theatre); $info=$_GET; if...
1
by: francsutherland | last post by:
Notice: Undefined index: send in D:\Domains\workingdata.co.uk\wwwroot\contact_text.php on line 7 Hi, I've started getting this error in the contact page form of my website. The web hosting...
10
by: FutureShock | last post by:
I have since recently turned up my error reporting on a production site to E_ALL to ensure I am using 'best practices' when writing out code. So far it has helped me discipline myself with...
11
by: stealthmode666 | last post by:
New to .php so need script help. I want to know how to stop this being displayed when I click submit. Notice: Undefined index: homeowner in E:\domains\r\...\user\htdocs\...\form.php on line 166 ...
4
by: complearn | last post by:
Do you know why I got these errors for status_bar.php in some webhost, but work perfectly on other webhost? Whats wrong? here are the codes from line 18, our webhost is running php5. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.