473,748 Members | 4,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I am making my first dynamic site and have an error

1 New Member
Hi, I am trying to make my first dynamic site using php. I am however getting the following error message on my first page:
_______________ _______________ _______________ __________
My first Page
home
tutorials

Notice: Undefined index: page in C:\wamp\www\tes t\index.php on line 18
welcome to my website
_______________ _______________ _______________ _________

my tutorial link works and doesnt display the error. but my index page makes this come up. my code is as follows
_______________ _______________ _______________ __________
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>My First Page</title>
  6. </head>
  7.  
  8. <body>
  9.  
  10. <h1>My first Page</h1>
  11.  
  12. <a href="index.php">home</a><br />
  13. <a href="index.php?page=tutorials">tutorials</a><br />
  14.  
  15.  
  16.  
  17. <?php
  18.  $page = $_GET['page'];
  19.  
  20.     if ($page)
  21.  
  22.     {
  23.         include ("content/".$page.".php");
  24.  
  25.         }
  26.         else
  27.         {
  28.  
  29.             echo "welcome to my website";
  30.             }
  31.  
  32.  
  33. ?>
  34.  
  35. </body>
  36. </html>
  37.  
_______________ _______________ _______________ _________

Please help if you can, Im using wamp and firefox!
Jan 12 '11 #1
1 1205
code green
1,726 Recognized Expert Top Contributor
If you click on this link
Expand|Select|Wrap|Line Numbers
  1. <a href="index.php">home</a><br /> 
You will get the error becuase this line
Expand|Select|Wrap|Line Numbers
  1. $page = $_GET['page'];
Is looking for something that doesn't exist.
Use isset()
Jan 13 '11 #2

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

Similar topics

1
2721
by: Mark | last post by:
Hi - Can anyone please help with the error message below - server is XP Pro, and the ASP code it is failing at is (set MM_rsUser.ActiveConnection... as below): <% MM_valUsername=CStr(Request.Form("username")) If MM_valUsername <> "" Then MM_redirectLoginSuccess="fixit_ebase.asp" MM_redirectLoginFailed="fixit_login.asp?failed=yes" MM_flag="ADODB.Recordset"
0
1134
by: intrader | last post by:
I am getting "500 Internal Server Error" while creating a new Web Project. The site is up for other existing projects, it is only when creating a new project. No folders are created yet, nothing has been written to. Please help!
14
2172
by: tasheeta | last post by:
In my simple program I am getting this error..please help I am trying to find integers where 65537i + 3551j = 1 error: cannot convert `__complex__ int' to `long int' in assignment #include <iostream> #include <complex>
2
2052
by: Andrew Ayers | last post by:
All, I am having a problem with an INSERT onto a table I have created. First off, here is the table: --- CREATE TABLE reg ("customer number" SERIAL PRIMARY KEY, "company name" VARCHAR(50) NULL, address VARCHAR(100) NULL, city VARCHAR(50) NULL, state VARCHAR(2) NULL, zip VARCHAR(50) NULL, phone VARCHAR(50) NULL,
5
6342
by: Tamar | last post by:
Hello all, I am so frustrated. I am doing something so simple and yet I confront such a problem. I am writing a program in VB, opening a db connection to an access db using ADODC control. I disply a record's fields and I can navigate through the recordset. BUT when trying to change a field content or when adding a new record I receive the error: 'operation was canceled' and from then I can no longer navigate the control. I installed VB's...
1
2161
by: Vishal Saxena | last post by:
Hi, I am new to this news group, hope to get prompt solution from you, gurus of VC. Well i had a project developed in VC++ 6.0, it uses Adobe Plugin Development SDK, I am trying to upgrade my project to VC++.NET, below is the code snipplet from the project
1
1307
by: momo | last post by:
Hello Guys, I am getting this error " Control 'oGrid__ctl14__ctl1' of type 'DataGridLinkButton' must be placed inside a form tag with runat=server." Here is my code and I don't know where it is doing it. Can some please help me
1
1987
by: JumpingOffPlace | last post by:
Hi, I'm hoping that the wealth of knowledge here can stop me from spinning my wheels on this syntax error for hours. :) Below is the code, and the error I am recieving.... Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <%@ taglib uri="/WEB-INF/tag-lib/struts-html-el.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/tag-lib/struts-bean.tld" prefix="bean" %>
0
1273
by: smtwtfs007 | last post by:
Any body has any idea about his error please? I got this error at the time of creating crystal report. I tried everything to resolve this error. But I could not. Please help. Exception has been thrown by the target of an invocation. at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean...
1
2440
by: alivip | last post by:
I integrat program to be GUI using Tkinter I try browser direction as you can see # a look at the Tkinter Text widget # use ctrl+c to copy, ctrl+x to cut selected text, # ctrl+v to paste, and ctrl+/ to select all # count words in a text and show the first ten items
0
8987
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9241
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.