PHP Learning curve

Discussion in 'PHP' started by macsee, Sep 7, 2012.

  1. #1
    Friends, I am a beginner and I need:A sample code with a textbox and submit button - I figured out how to get thiis.After clicking on submit, it should ech text entered in the above text box on the same page - Please help me in doing this.
     
    macsee, Sep 7, 2012 IP
  2. Triggs

    Triggs Active Member

    Messages:
    84
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    93
    #2
    Could you explain more?
     
    Triggs, Sep 7, 2012 IP
  3. macsee

    macsee Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    In fact I have never used PHP and working hard on a project. Let me explain the entire thing what I am looking at.

    Here is a function:
    <?php
    $total =0;
    mysql_connect ("localhost", "wysiwyg", "password") or die ('Error: '

    .mysql_error());
    mysql_select_db ("network");

    function getTotalLeg($memid,$leg){
    $sql="select member_id from members where parent_id='".$memid."' and

    leg_position='".$leg."'";
    $res=mysql_query($sql) or exit( mysql_error() );
    global $total;
    $total=$total+mysql_num_rows($res);
    $row=mysql_fetch_array($res);
    if($row['member_id']!=''){
    getTotalLeg ($row['member_id'],'l');
    getTotalLeg ($row['member_id'],'r');
    }
    return $total;
    }
    Here is the function call
    <?php
    echo "left = ";
    echo getTotalLeg("mlm10006","l");
    echo "<br/>";
    $total =0;
    echo "right = ";
    echo getTotalLeg("mlm10006","r");
    ?>

    The current echo statments prints value of r and l. Instead of echoing what I need, I need to have a textbox which will have mlm1006 as the userinput on clicking on submit button, it should return a value Left = xx and Right = xx
     
    macsee, Sep 7, 2012 IP