i created a registeration form which i linked to my database whenever i try to make i data registeration i always get this error:Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

this is the registeration file

`<?php include('config.php') ?>
<!DOCTYPE html>
<html>
  <head>
    <title>Educational registration form</title>
    <link rel="stylesheet" type="text/css" href="css/regis.css">

  </head>
  <body>
    <div class="main-block">
      <div class="left-part">
        <i class="fas fa-graduation-cap"></i>
        <h1>Register to our courses</h1>
        <p>W3docs provides free learning materials for programming languages like HTML, CSS, Java Script, PHP etc.</p>
             </div>
      <form method="post"  action="registration.php">
         <?php include('error.php'); ?>
        <div class="title">
          <i class="fas fa-pencil-alt"></i> 

          <h2>Register here</h2>
        </div>
        <div class="info">
            <input class="ID" type="text" name="ID" placeholder="Student ID">
          <input class="fname" type="text" name="Surname" placeholder="Surname">
           <input class="oname" type="text" name="othernames" placeholder="Othernames">
            <select name="program">
              <option value="program" selected>Program*</option>
              <option value="Bsc.Informarion Technology">Bsc.Information Technology</option>
              <option value="Bsc.Business Administration">Bsc.Business Administration(Human resource)</option>
              <option value="Bsc.Computer Science">Bsc.Computer Science</option>
              <option value="Bsc.Computer Engineering">Bsc.Computer Engineering</option>
              <option value="BEng.Civil Engineering">BEng.Civil Engineering</option>
              <option value="BEng.Electrical Engineering">BEng.Electrical Engineering</option>
              <option value="Bsc.Business Administration(with IT)">Bsc.Business Administration(with IT)</option>
           </select>
           <input type="password" name="password" placeholder="Password">
           <input type="password" name="password2" placeholder="Confirm Password">

        </div>  
        <button type="submit" name="register" >Submit</button>
      </form>
    </div>
  </body>
</html>

and this if my config.php code

`<?php
    session_start();
    $ID="";
    $Surname="";
    $othernames="";
    $errors=array();
    //connecting to database
    $db = mysqli_connect('localhost','root','','useraccount');

    //if sign in button is clicked
    if (isset($_POST['register'])) {
        $ID = mysqli_real_escape_string($db,$_POST['ID']);
        $Surname = mysqli_real_escape_string($db,$_POST['Surname']);
        $othernames = mysqli_real_escape_string($db,$_POST['othernames']);
        $program = mysqli_real_escape_string($db,$_POST['program']);
        $password = mysqli_real_escape_string($db,$_POST['password']);
        $password2 = mysqli_real_escape_string($db,$_POST['password2']);

        // to ensure fields are filled
        if (empty($ID)) {
            array_push($errors,"ID is required");
        }
        if (empty($Surname)) {
            array_push($errors,"Surname is required");
        }
        if (empty($othernames)) {
            array_push($errors,"This field is required");
        }
        if (empty($password)) {
            array_push($errors,"Password is required");
        }
        if ($password!=$password2) {
            array_push($errors,"Password do not match");
        }

        //if everything checks out

        if (count($errors)==0) {
            $password=md5($password);//ENCRYPTING PASSWORD INTO DATABASE
            $sql="INSERT INTO users(ID,Surname,othernames,program,password,password2)
            VALUES('$ID','$Surname','$othernames','$program','$password','$password2')";
            mysqli_query($db,$sql);

        }
    }

    //login
    if (isset($_POST['login'])) {
        $ID = mysqli_real_escape_string($db,$_POST['ID']);
        $password = mysqli_real_escape_string($db,$_POST['password']);

        if (empty($ID)) {
            array_push($errors,"ID is required");
        }

        if (empty($password)) {
            array_push($errors,"password is required");
        }

        if (count($errors)==0) {
            $password=md5($password);//encrypting password before comparing to database
            $query="SELECT * FROM users WHERE username='ID' AND password='$password'";
            $result=mysqli_query($db,$query);
            if (mysqli_num_rows($result)==0) {
                //user log in
                $_SESSION['ID']=$ID;
                $_SESSION['sucess']="You are now logged in";
                header('location:index.php');
            }else{
                array_push($errors, "wrong username and password combination");
            }

        }

    }

//logout
    if (isset($_GET['logout'])) {
        session_destroy();
        unset($_SESSION['ID']);
        header('location: login.php'); 
    }

  ?>``

is there a solution to this ?

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

Here you submit to registration.php

and this if my config.php code

while you state that your file is named config.php

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.