SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Learning PHP

  1. #1
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Learning PHP

    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.

  2. #2
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Sounds like answer to a homework

  3. #3
    SitePoint Member
    Join Date
    Sep 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ha ha
    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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •