d.jobinraj 0 Newbie Poster

the problem is town and user values is not adding to the database,other than this feilds,other thuings are working down.......
please,give me your suggestions.

//database.php//


   function addReceipe($resname,$restype,$rescatg,$resing,$resmethod){
      if(!get_magic_quotes_gpc()){
        $resname   = addslashes($resname);
        $restype   = addslashes($restype);
        $rescatg   = addslashes($rescatg);
        $resing    = addslashes($resing);
        $resmethod = addslashes($resmethod);
      }
      $q = "INSERT INTO ".TBL_RECEIPE."(rescp_name,rescp_type,rescp_catg,rescp_ing,rescp_method) VALUES ('$resname','$restype', '$rescatg', '$resing', '$resmethod')";
      return mysql_query($q, $this->connection);
   }

   function addTown($townname,$pincode){
      if(!get_magic_quotes_gpc()){
        $townname   = addslashes($townname);
        $pincode   = addslashes($pincode);

      }
      $q = "INSERT INTO ".poovai_townlist."(townname,pincode) VALUES ('$townname','$pincode') ";
      return mysql_query($q, $this->connection);

   }

   function addUser($name,$homeno,$address1,$address2,$address3,$city,$pincode){
      if(!get_magic_quotes_gpc()){
            $name       = addslashes($name);
            $homeno     = addslashes($homeno);
            $address1   = addslashes($address1);
            $address2   = addslashes($address2);
            $address3   = addslashes($address3);
            $city       = addslashes($city);
            $pincode    = addslashes($pincode);
   }
   $q = "INSERT INTO ".Cust_Address."(name,townid,city,homeno,address1,address2,address3,pincode) VALUES ('$name',(select townid from poovai_townlist where townname='$city'),'$city','$homeno','$address1','$address2','$address3','$pincode')";
   return mysql_query($q, $this->connection);
   }



//the form of the above database is adminprocess.php//



      /* Admin submitted to add receipe */
      else if(isset($_POST['addrescp'])){
         $this->procAddReceipe();
      }

      /* Admin submitted to add news */
      else if(isset($_POST['addnews'])){
         $this->procAddNews();
      }



     /*users added in the Cust_address list syed added*/
      else if(isset($_POST['adduser'])){
        $this->procAddUser();
      }


   /* procAddtown  - Adds the townname to the townlist table */
     procAddtown  - Adds the townname, pincode to the townlist table and sub-town name and pincode to the subtownlist table  */
     function  procAddTown(){
     global $session,$database;
     $s = $database->addTown($_POST['townname'] , $_POST['pincode']);

     if(isset($_POST['subtownname'])){
         if($_POST['subtownname']){
        $st = $database->addSubTown($_POST['pincode'] , $_POST['subtownname'], $_POST['subtownpincode']);
     }
     else{
         $st=2;
     }
     }
     header("Location:".$session->referrer."?tbl=13&queryR=".$s."&queryRR=".$st);
   }



   /*procAddUser - Adds the user history in Cust_Address table*/
     function  procAddUser(){
     global $session, $database;
     $s = $database->addUser($_POST['name'], $_POST['homeno'], $_POST['address1'], $_POST['address2'], $_POST['address3'], $_POST['city'], $_POST['pincode']);
     header("Location:".$session->referrer);
     }
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.