I have the following code in a class: Essentially the the values are retrieved using in the process-handler file and then they get processed and "inserted" into the table. However i know how to do it with MySQL but i know it is different with SQL server. I also made the connection to the SQL server in a different file, where it checks if the connection was made in a try catch block.

file-name: Item.php

class name
    public function submit($dateCreated , $choice, $user, $mainD, $sideD, $otherD, $date){
        //below are fucntion that check if the parameters are either blank or in format

            return $this->insertItemDetails($dateCreated , $choice, $user, $mainD, $sideD, $otherD, $date);

    private function insertItemDetails($dateCreated , $choice, $user, $mainD, $sideD, $otherD, $date){

        //inserts into sql database


file-name: process-handler.php Gets the values from the input boxes from the same page.


    //if register button wass pressed
    $firstDate = date("Y-m-d");
    $menuChoice = $_POST['iChoiceID'];
    $user = $_SESSION['userID'];
    $main =  $_POST['txtMain'];
    $side =  $_POST['txtSide'];
    $other =  $_POST['txtAlternative'];
    $secondDate =  $_POST['itemDate'];

    $wasSuccessful = $menuItems->submit($firstDate, $Choice, $user, $main, $side, $other, $secondDate );
    if ($wasSuccessful == true){
        echo("Items have been processed! Check in vservices for outcome.");


0 Answers