Need to arrange PHP code to MVC design pattern

Hi all,
New to PHP and to the forum. I need help arranging some PHP code in MVC design pattern. Not sure where to get started. I have an accompanying HTML that calls upon this PHP script. I assume I need to break the PHP file into pieces in order to accomplish this. Any help would be great. Here is the PHP code:

Insert a New Product Flamingo Product Insert      

<?php $dbConn = odbc_connect("flamingo","","") or die("Error opening database .... use the browsers BACK button"); $code = $_POST["ProductCode"]; $name = $_POST["ProductName"]; $desc = $_POST["ProductDes"]; $price = $_POST["ProductPrice"]; $sqlQuery = "select * from prodList where prodCode='" . $code . "'"; $dbResult = odbc_exec($dbConn,$sqlQuery) or die("Error, Product Listing failed .... use the browsers BACK button"); $res = odbc_fetch_row($dbResult); if ($res == TRUE) { echo("

The product with code " .$code. " already exists"); echo("

Continue"); } else { $sqlQuery = "insert into prodList (prodCode,prodName,prodDesc,prodPrice) values ('".$code."','".$name."','".$desc."','".$price."')"; $dbResult = odbc_exec($dbConn,$sqlQuery) or die("Error.... use the browsers BACK button"); echo("

Product Insert Successful

"); echo("

Return to Pronduct Insert Screen"); echo("

Return to Main Screen"); } odbc_close($dbConn); ?>

Sponsor our Newsletter | Privacy Policy | Terms of Service