May I know why I cannot submit my search function by pressing enter? When I enter the primary key and press enter, it will show this :
Notice: Undefined index: submit in c:\easyphp1-8\www\efiling\accountingdeleteprocess.php on line 23

But if I enter the primary key and press the submit button, there is no error. May I know how to make it can search by pressing enter?
Below is my coding :

AccountingDelete.php

<html>
<head>
<title>Index</title>
</head>

<body background="E-Filing%20Management%20System%20Picture/Snow.gif">
<p align="center">
<img border="0" src="E-Filing%20Management%20System%20Picture/logo-RR-gif.gif" width="957" height="245"></p>
<p align="center"><span lang="zh-cn">&nbsp;</span></p>
<p align="center"><span lang="zh-cn"><img border="0" src="E-Filing%20Management%20System%20Picture/Accounting.gif" width="491" height="73"></span></p>
<p align="center"><span lang="zh-cn">&nbsp;</span></p>
<form method="POST" action="AccountingDeleteProcess.php"> 



<p align="center"><font size='3' face='Arial Rounded MT Bold'><font color='#FFFFFF'>Enter Primary Key to Delete :&nbsp;&nbsp;<input type="text" name="PK" size="6">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="submit" value="Search" > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="submit" value=" Back " > </font></font></p>

<?php
	echo "<br><br><br>";
?>

</form> 
<p align="center"></p>
<p align="center"></p>
<p align="center"></p>
<p align="center"></p>
<p align="center"></p>

</body>
</html>

AccountingDeleteProcess.php

<html>
<head>
<title>Index</title>
</head>

<body background="E-Filing%20Management%20System%20Picture/Snow.gif">

<p align="center">
<img border="0" src="E-Filing%20Management%20System%20Picture/logo-RR-gif.gif" width="957" height="245"></p>
<p align="center"><span lang="zh-cn">&nbsp;</span></p>
<p align="center"><span lang="zh-cn"><img border="0" src="E-Filing%20Management%20System%20Picture/Accounting.gif" width="491" height="73"></span></p>
<p align="center"><span lang="zh-cn">&nbsp;</span></p>

<form method="post" action="AccountingDeleteProcess.php">

<?php
	$connection = mysql_connect("localhost", "root", "")   
		or die("<font color='#FFFFFF'>Could not connect to MySQL </font>" .mysql_error());

	$selection = mysql_select_db("efiling")   
		or die("<font color='#FFFFFF'>Unable to select database.</font>" .mysql_error());
		
	$submit = $_POST["submit"];
	
	if($submit=="Search")
	{
    		if(isset($_POST["PK"]))
    		{ 
    			$PK = $_POST["PK"];
	  		$sql = "SELECT * from accounting where PriKey ='$PK'";
	   		$result = mysql_query($sql) 
	  			or die("<font color='#FFFFFF'>SQL select statement failed</font>");
	  
	  		if($row=mysql_fetch_array($result))
       	    		{  
            			echo "<table align='center' cellpadding='4'>";
       	    			echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Index &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[ID]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Company Name &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[CompanyName]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
		
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Company Number &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[CompanyNumber]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Director Name &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[DirectorName]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Telephone Number &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[TelephoneNumber]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
		
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Fax Number &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[FaxNumber]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Company Address &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[CompanyAddress]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Correspondence Address &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[CorrespondenceAddress]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
	
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Email &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[Email]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
						
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "AGM Date &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[AgmDate]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
						
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Account Financial Year End &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[AccountFinancial]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
						echo "</table>";
       	        		
       	        		echo "<table align='center' cellpadding='4' width='715'>";
						echo "<tr><td>";
						echo "<input type='hidden' name='PK' value='$row[PriKey]'> ";
						echo "<br><p align='center'><input type='submit' name='submit' value='Delete'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
						echo "<input type ='submit' name='submit' value='Back'></p>";	
						echo "</td></tr>";
						echo "</table>";
            		}
            
	 		else 
	 		{ 
	 			echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'><p align='center'>No Record Found</p></font></font><br><br>"; 
	 			echo "<p align='center'><input type ='submit' name='submit' value='Back'></p>";		
	 		}
     		}  
	}
	
	if($submit=="Delete")
	{	
		$PK = $_POST["PK"];
    		$sql= "DELETE FROM accounting WHERE PriKey = '$PK'";
    		$result = mysql_query($sql);
    		echo "<hr><h2><font color='#FFFFFF'><p align='center'>Record Deleted</p></hr></h2><br>";
    		echo "<p align='center'><input type ='submit' name='submit' value='Back'></p>";
 	}   
	
	if($submit=="Back")
	{	
		print "<script language ='javascript'>window.location.href='AccountingDelete.php'</script>";
 	}
 	
 	if($submit==" Back ")
	{	
		print "<script language ='javascript'>window.location.href='Accounting.php'</script>";
 	}
?>


<p align="center"></p>
<p align="center"></p>
<p align="center"></p>
<p align="center"></p>
<p align="center"></p>

</body>
</html>

Recommended Answers

All 2 Replies

try out this in your AccountingDeleteProcess.php

<html>
<head>
<title>Index</title>
</head>

<body background="E-Filing%20Management%20System%20Picture/Snow.gif">

<p align="center">
<img border="0" src="E-Filing%20Management%20System%20Picture/logo-RR-gif.gif" width="957" height="245"></p>
<p align="center"><span lang="zh-cn">&nbsp;</span></p>
<p align="center"><span lang="zh-cn"><img border="0" src="E-Filing%20Management%20System%20Picture/Accounting.gif" width="491" height="73"></span></p>
<p align="center"><span lang="zh-cn">&nbsp;</span></p>

<form method="post" action="AccountingDeleteProcess.php">

<?php
	$connection = mysql_connect("localhost", "root", "")   
		or die("<font color='#FFFFFF'>Could not connect to MySQL </font>" .mysql_error());

	$selection = mysql_select_db("efiling")   
		or die("<font color='#FFFFFF'>Unable to select database.</font>" .mysql_error());
		
	if(isset($_POST["submit"])){
$submit = $_POST["submit"];
	
	if($submit=="Search")
	{
    		if(isset($_POST["PK"]))
    		{ 
    			$PK = $_POST["PK"];
	  		$sql = "SELECT * from accounting where PriKey ='$PK'";
	   		$result = mysql_query($sql) 
	  			or die("<font color='#FFFFFF'>SQL select statement failed</font>");
	  
	  		if($row=mysql_fetch_array($result))
       	    		{  
            			echo "<table align='center' cellpadding='4'>";
       	    			echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Index &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[ID]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Company Name &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[CompanyName]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
		
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Company Number &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[CompanyNumber]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Director Name &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[DirectorName]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Telephone Number &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[TelephoneNumber]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
		
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Fax Number &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[FaxNumber]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Company Address &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[CompanyAddress]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";

						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Correspondence Address &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[CorrespondenceAddress]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
	
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Email &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[Email]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
						
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "AGM Date &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[AgmDate]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
						
						echo "<tr><td>";
						echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>";
						echo "Account Financial Year End &nbsp; : ";
						echo "</font></font><p align='center'> </p>";
						echo "</td><td><font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'>$row[AccountFinancial]</font></font><br><br>";
						echo "<p align='center'> </p></p>";
						echo "</td></tr>";
						echo "</table>";
       	        		
       	        		echo "<table align='center' cellpadding='4' width='715'>";
						echo "<tr><td>";
						echo "<input type='hidden' name='PK' value='$row[PriKey]'> ";
						echo "<br><p align='center'><input type='submit' name='submit' value='Delete'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
						echo "<input type ='submit' name='submit' value='Back'></p>";	
						echo "</td></tr>";
						echo "</table>";
            		}
            
	 		else 
	 		{ 
	 			echo "<font size='4' face='Arial Rounded MT Bold'><font color='#FFFFFF'><p align='center'>No Record Found</p></font></font><br><br>"; 
	 			echo "<p align='center'><input type ='submit' name='submit' value='Back'></p>";		
	 		}
     		}  
	}
	
	if($submit=="Delete")
	{	
		$PK = $_POST["PK"];
    		$sql= "DELETE FROM accounting WHERE PriKey = '$PK'";
    		$result = mysql_query($sql);
    		echo "<hr><h2><font color='#FFFFFF'><p align='center'>Record Deleted</p></hr></h2><br>";
    		echo "<p align='center'><input type ='submit' name='submit' value='Back'></p>";
 	}   
	
	if($submit=="Back")
	{	
		print "<script language ='javascript'>window.location.href='AccountingDelete.php'</script>";
 	}
 	
 	if($submit==" Back ")
	{	
		print "<script language ='javascript'>window.location.href='Accounting.php'</script>";
 	}

}
?>


<p align="center"></p>
<p align="center"></p>
<p align="center"></p>
<p align="center"></p>
<p align="center"></p>

</body>
</html>

the error no come out already. But it does not call out the database, after submit just appear the background only.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.