can anyone let me know what the wrong thing here as i am not able to add subcategories to category

<div class="col-lg-4 mx-md-auto paper-card"> <?php

                if ( isset( $_POST[ 'submit' ] ) ) {
                    if ( empty( $_POST[ 'subcat' ] ) ) {
                        echo '<span style="color: red;"> Please Fill in the Category Name</span> ';
                    } else {

                        $subcat =clean($_POST[ 'subcat' ]);
    $query = "insert into subcategory values ('','$_POST[cat]','$subcat')";
                        $result = mysqli_query( $con, $query );

                        if ( $result ) {
                            echo '<span style="color: green;">Category Added Successfully</span>';
                        } else {
                            echo '  Please Check Your Query ';
                        }
                    }
                }

                ?> <form method="post" action=""> <div class="form-group"> <lable>Sub Category Name</lable> <input type="text" class="form-control" name="subcat"/> </div> <div class="form-group"> <lable>Select Category</lable> <select class="form_control" name="cat"> <?php 

            $query="select * from category";
            $sql=mysqli_query($con,$query);
            if(mysqli_num_rows($sql)>0){
                while($row=mysqli_fetch_assoc($sql)){

            ?> <option value="<?php echo $row['cid']; ?>"> <?php echo $row['catname']; ?> </option> <?php 
                    }   
            }       
                ?> </select> </div> <div class="form-group"> <button class="btn btn-primary" name="submit">Submit</button> </div> </form> </div> </div></div>

        <div class="col-lg-4 mx-md-auto paper-card"> <?php

            if ( isset( $_POST[ 'submit' ] ) ) {
                if ( empty( $_POST[ 'subcat' ] ) ) {
                    echo '<span style="color: red;"> Please Fill in the Category Name</span> ';
                } else {

                    $subcat =clean($_POST[ 'subcat' ]);
$query = "insert into subcategory values ('','$_POST[cat]','$subcat')";
                    $result = mysqli_query( $con, $query );

                    if ( $result ) {
                        echo '<span style="color: green;">Category Added Successfully</span>';
                    } else {
                        echo '  Please Check Your Query ';
                    }
                }
            }

            ?> <form method="post" action=""> <div class="form-group"> <lable>Sub Category Name</lable> <input type="text" class="form-control" name="subcat"/> </div> <div class="form-group"> <lable>Select Category</lable> <select class="form_control" name="cat"> <?php 

        $query="select * from category";
        $sql=mysqli_query($con,$query);
        if(mysqli_num_rows($sql)>0){
            while($row=mysqli_fetch_assoc($sql)){

        ?> <option value="<?php echo $row['cid']; ?>"> <?php echo $row['catname']; ?> </option> <?php 
                }   
        }       
            ?> </select> </div> <div class="form-group"> <button class="btn btn-primary" name="submit">Submit</button> </div> </form> </div> </div></div>

opps noboday knows the error here... very strange

error is it just say please check query

and i am not getting what is wrong in the query

just need to add subcateogries to categories

Here's the other reason you may not be getting replies. Read the link I gave and the second "Composing a good question".
So far you have a dump and no questions. Questions should be in the form of a question followed by the question mark so it's clear what you are asking.

One more time. Read the link about "Composing a good question". Pare down the code to just what's needed and if some SQL database schema is needed to understand you have to share that as well.

Finally. Spend some time on grammer. Sentences should start with a capital letter and end with the usual period, question mark or !

Spend some time on grammer (sic). Sentences should start with a capital letter and end with the usual period, question mark or !

It's pretty obvious that English isn't s_15's first language. I doubt (s)he came here for a language lesson, and grammar shaming isn't what DaniWeb is for. So let's be tolerant of one another's English and concentrate on the actual reason for this topic.

@JC. I didn't intend to shame anyone. Let's hope they spend time on their composition of the question.

commented: Agreed James Cherrill +15

i think getting help from here is usless as noboday want to help but just chatter here thinking to disable my account here as its useless that anyone will help :)

People here do want to help you, but the information you have provided is not sufficient. Did you take the time to check rproffitt's link in his first answer?

i think i am clear what i am asking and put the full code also and the error also still no boday know the query for it :) i donot know what you want to have in the question

The suggestion was to "Pare down the code to just what's needed and if some SQL database schema is needed to understand you have to share that as well" rather than just dump all your code, to be fair. Try doing that before giving up. You have to make it as easy as possible for the people who want to help you to be able to help you, if you see what I mean.

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.