<table width="300" border="5">

      <tr>


   <td>FirstName:</td> 
   <td><input type="text" id="fname" name="fname"/></td>
   </tr>


    <tr>
    <td>SurName:</td>
    <td><input type="text" id="sname" name="sname"/></td>
    </tr>


    <tr>
    <td>Age:</td> 
    <td><input type="text" id="age" name="age"/></td>
    </tr>

    <tr>
    <td><input type="radio" id="gen" name="gen" value="Male"/>Male
    <input type="radio" id="gen" name="gen" value="Female"/>Female</td>
    </tr>

    <tr>
    <td>Subject:</td>
    <td><input type="text" id="subject" name="subject"/></td>
    </tr>

    <tr>
    <td>Score:</td>
    <td><input type="number" id="score" name="score"/></td>
    </tr>
    </table>

    <input type="reset"name="reset"/>

    <input type="submit" id="sbm" name="sbm" value="submit"/>

You need to send the data to grade.php?
That would be the action part of your form tag

Member Avatar

can't see any form tags :(

<html>
<head>
<title>Form Sheet</title>

<style> 

</style>
<script type="text/javascript">

</script>




</head>


<body>

</body>

<form name="formsheet" action="grade.php"  method="post">

       <table width="300" border="5">
       <tr>
       <td>FirstName:</td> 
       <td><input type="text" id="fname" name="fname"/></td>
       </tr>


        <tr>
        <td>SurName:</td>
        <td><input type="text" id="sname" name="sname"/></td>
        </tr>


        <tr>
        <td>Age:</td> 
        <td><input type="text" id="age" name="age"/></td>
        </tr>

        <tr>
        <td><input type="radio" id="gen" name="gen" value="Male"/>Male
        <input type="radio" id="gen" name="gen" value="Female"/>Female</td>
        </tr>

        <tr>
        <td>Subject:</td>
        <td><input type="text" id="subject" name="subject"/></td>
        </tr>

        <tr>
        <td>Score:</td>
        <td><input type="number" id="score" name="score"/></td>
        </tr>
        </table>

        <input type="reset"name="reset"/>

        <input type="submit" id="sbm" name="sbm" value="submit"/>

        <p><h3>would you like to go to the Home page?<a href="homepage.html">click here</a></h3></p>

</form>


</body>
</html>

this is actually my code but i dont know how to do the validation part for it

Great post, I'm going to forward this onto our designer. He needs to read this post (no doubt). Thanks for sharing.

Member Avatar

1) take off the first </body> tag

2) use a doctype declaration <!DOCTYPE HTML>

3) avoid tables for and inline attributes for formatting - ALL of it should be done in CSS

4) Your line <p><h3>...</h3></p> makes no sense. Both are block level elements. Doing this can mess up your formatting if using relative fontsizes.

So before you plunge into php, perhaps it would be time to look at html and css. Only then, once you've mastered these markups, do I suggest getting your hands dirty with coding.

this is actually my code but i dont know how to do the validation part for it

It's not code, it's markup. You haven't included any php code for us to help you with. Please attempt some basic data collection at least (e.g. $_POST['fname']). Validation functions can be found at:

http://php.net/manual/en/filter.filters.validate.php