Getting the content length of posted values

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rajujrk
    New Member
    • Aug 2008
    • 107

    Getting the content length of posted values

    hi,

    i am currently creating one page processing the username and password , and prints the value given in that textboxes.

    it is a single php script contains both the design and server script.

    That is form action and actual page is same..

    for example the below script is saved as login.php
    Code:
     
    
    <form method="post" action="login.php">
    : :
    : :
    </form>
    <?php
    $s=$_POST['user'];
    $p=$_POST['pass'];
    in Asp i use to get the content length is request.TotalBy tes
    in JSP i use to get the content length is request.getCont entLength
    How do we get it in PHP?

    Thanks in Advance..
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    do you mean strlen($_POST['user']);?

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      Heya, rajujrk.

      If you want to see if the User submitted anything, do this:
      [code=php]
      if( ! empty($_POST) )
      [/code]

      Determine whether a variable is empty


      If you need the actual length of the POST data, your best bet would be to do something like this:

      [code=php]
      strlen(http_bui ld_query($_POST ))
      [/code]


      Comment

      • rajujrk
        New Member
        • Aug 2008
        • 107

        #4
        Originally posted by Dormilich
        do you mean strlen($_POST['user']);?
        content length not only for a single field

        i want check all the fields values

        Comment

        • rajujrk
          New Member
          • Aug 2008
          • 107

          #5
          Originally posted by pbmods
          Heya, rajujrk.

          If you want to see if the User submitted anything, do this:
          [code=php]
          if( ! empty($_POST) )
          [/code]

          Determine whether a variable is empty


          If you need the actual length of the POST data, your best bet would be to do something like this:

          [code=php]
          strlen(http_bui ld_query($_POST ))
          [/code]


          http://php.net/http_build_query
          Ya fine..

          Its working well

          Thank you

          Comment

          Working...