I'm a new PHP developer and am trying to develop my application using best practise programming techniques.
I am creating an admin area whereby I have a page to modify the contects of a table, I am using PHP_SELF when the new details are submitted but when I am submitting I recieve the following error:
PHP Notice: Undefined index: submit in C:\project\modifyman.php on line 53
I have tried and tried to sort this out but no joy, I would really appreciate somebodies help.
CODE:
<?php
//include connection to database
include "common_db.php";
//bring in database connection values
$Link;
//grabs the variable manufacturer from form
$manufacturer = "Null";
$submit = "false";
if ($submit=="false")
{
//query database
$Query = "SELECT dbManufacturerName FROM manufacturer";
//define what variable result
$Result = mysql_db_query ($DBName, $Query, $Link);
$self = $_SERVER['PHP_SELF'];
//create a form
print ("<font face='verdana' size='1'>");
print ("<form method='get' action='$self'>\n");
print ("<br>");
print ("Select a Manufacturer to modify:\n");
print ("<select name='manufacturer' style='font-family: verdana; font-size: 8pt'>\n");
//fetch the results from the database
while ($Row = mysql_fetch_array ($Result)) {
print ("<option value='$Row[dbManufacturerName]'>$Row[dbManufacturerName]\n");
}
//closes link to database
mysql_close($Link);
//completes html code
print ("</select>");
print ("<input type='submit' name='submit' value='true'>");
print ("</form>");
print ("</font>");
$submit = $_REQUEST["submit"];
}
if ($submit="true")
{
//displays current values in a form so that they can be edited
//grabs the variable manufacturer from above form
//$manufacturer = "Null";
//grabs the variable manufacturer from above form
$manufacturer = $_REQUEST["manufacturer"];
//print form header
print ("<font face='verdana'><h3>Modify $manufacturer:</h3>");
print ("<font face='verdana' size='1'>");
//include connection to database
include "common_db.php";
//bring in database values
$Link;
//query database
$Query = "SELECT * FROM manufacturer where dbManufacturerName = '$manufacturer'";
$Result = mysql_db_query ($DBName, $Query, $Link);
//Create a form
while ($Row = mysql_fetch_array ($Result)) {
print ("<form method=get action='modifyman.php4'>\n");
print ("<br>");
print ("Manufacturer Name:\n");
print ("<input type='text' name='manufacturer_name' maxlength='30' style='font-family: verdana; font-size: 8pt' value='$Row[dbManufacturerName]'><br>\n");
//complete html
print ("<br>");
print ("<input type='submit' style='font-family: verdana; font-size: 8pt' value='Update'>");
print ("</form>");
print ("<a href='navigation.php4'>Navigation Page</a>");
print ("</font>");
}
}
?>


