PHP Notice Problem
I am trying to use one page to display a form the when the page is first
accessed. Once the form is submitted then I want to use that page to process
the information and display the results. The fun part to this is that I am
getting this message:
"Notice: Undefined index: search in C:\Documents and Settings...\db_search.php
on line 13"
The first time the page is loaded the _GET['search'] hasn't been used and so I
think that is why it is giving me the notice.
I am running this off of the apache server I set up on my home computer. Other
php pages have worked fine but this one doesn't make sense.
Here is the code for the page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>DB Search Page</title>
<link href="db_input.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$search = $_GET['search'];
$self = $_SERVER['PHP_SELF'];
if ($search != NULL)
{
('
<form action="'.$_SERVER["PHP_SELF"].'" method="GET">
<label>Search: <input type="text name="search" />
</label>
<input type="submit" value="Find It Now!!!!" />
</form>
');
}
?>
</body>
</html>
|