#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0

    Need a php code to display Gp of ten courses using function


    My texfield names inclube: ['name'] ['department'] ['regnos'] ['com111'] ['com112'] ['com113'] ['com101'] ['math111'] ['math112'] ['math113'] ['gns127'] ['otm126']

    Comments on this post

    • ptr2void disagrees : Do your own damn homework, slacker!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,502
    Rep Power
    594
    Post what you have tried and explain what doesn't work. We won't do your homework for you but we will point you in the right direction.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0
    I have tried and isnt working. My code is: <?php
    $name=$_POST['name'];
    $regnos=$_POST['regnos'];
    $department=$_POST['department'];
    $com111=$_POST['com111'];
    $com101=$_POST['com101'];
    $com112=$_POST['com112'];
    $com113=$POST['com113'];
    $math111=$_POST['math111'];
    $math112=$_POST['math112'];
    $math113=$_POST['math113'];
    $gns127=$_POST['gns127'];
    $otm126=$_POST['otm126'];

    function grade($grade1){
    if($grade1>=70 and $grade1<=100)
    {
    $grade1="4*4.0";
    }elseif($grade1>=70 and $grade1<=74)
    {
    $grade1="4*3.75";
    }elseif($grade1>=65 and $grade1<=74)
    {
    $grade1="4*3.50";
    }elseif($grade1>=65 and $grade1<=69)
    {
    $grade1="4*3.0";
    }elseif($grade1>=60
    and $grade1<=64)
    {
    $grade1="4*2.75";
    }elseif($grade1>=50 and $grade1<=54)
    {
    $grade1="4*2.50";
    }
    return $grade1;
    echo $com111." " .grade($com111). "<br>";
    echo $com112." " . grade($com112). "<br>";
    echo $com113. " " . grade($com113). "<br>";
    echo $com101. " " . grade($com101). " <br>";
    echo $math111." " . grade($math111). "<br>;
    echo $math112." ". grade($math112). "<br>";
    echo $math113." " . grade($math113). "<br>";
    echo $gns127." " . grade($gns127). "<br>";
    echo $otm126." ". grade($otm126). "<br>";

    ?>

    The program is giving me undefined index in all my $_POST entries. Plz i nid serious help. Tanxs nd God bless!
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0

    Have tried it


    Dude,i have tried it and it is giving me undefined index
  8. #5
  9. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Dude, then obviously you aren't POSTing anything to your script. How do you run your script? What's the exact content of $_POST?
    Code:
    var_dump($_POST);
    You need to make an HTML form with a field for each "name", "regnos", "department" etc. And this form has to be sent to your script.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0

    Tanxs 4 ur help


    Brother,plz i still can't get wot u mean. Plz can u help me re-write d code? Tanxs 4 ur help nd may God bless You
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,502
    Rep Power
    594
    Let's start at the beginning. In order for $_POST to have any data in it, you need to submit it with a form. Post the HTML of your form.

    Note: Please enclose your code in [ PHP ] tags. See the sticky at the top of this forum. Edit your original post.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0

    I have goten my form


    I have designed my form very well and all is remaining is to create my procesingpage wich is the coding and afta which i add d action 2 my form. My textfied name includes:

    name
    regnos
    department
    com101
    com112
    com111
    com113
    math111
    math112
    math113
    gns127
    otm126
    Plz help me with d right code
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,502
    Rep Power
    594
    Not very well as far as I can see. There is no form.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  18. #10
  19. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Man, sometimes it's like we were f*cking interrogators, who have to beat secret information out of people...

    Comments on this post

    • gw1500se agrees : I'm about to give up on this OP and let someone else with more patience try it. No idea why the OP refuses to provide relevant information.
    • ptr2void agrees : No patience for help vampires here either.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo