473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Getting the content length of posted values

107 100+
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
Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <form method="post" action="login.php">
  4. : :
  5. : :
  6. </form>
  7. <?php
  8. $s=$_POST['user'];
  9. $p=$_POST['pass'];
  10.  
in Asp i use to get the content length is request.TotalBytes
in JSP i use to get the content length is request.getContentLength
How do we get it in PHP?

Thanks in Advance..
Sep 30 '08 #1
4 6664
Dormilich
8,658 Expert Mod 8TB
do you mean strlen($_POST['user']);?
Sep 30 '08 #2
pbmods
5,821 Expert 4TB
Heya, rajujrk.

If you want to see if the User submitted anything, do this:
Expand|Select|Wrap|Line Numbers
  1. if( ! empty($_POST) )
  2.  
http://php.net/empty

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

Expand|Select|Wrap|Line Numbers
  1. strlen(http_build_query($_POST))
  2.  
http://php.net/strlen
http://php.net/http_build_query
Sep 30 '08 #3
rajujrk
107 100+
do you mean strlen($_POST['user']);?
content length not only for a single field

i want check all the fields values
Oct 1 '08 #4
rajujrk
107 100+
Heya, rajujrk.

If you want to see if the User submitted anything, do this:
Expand|Select|Wrap|Line Numbers
  1. if( ! empty($_POST) )
  2.  
http://php.net/empty

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

Expand|Select|Wrap|Line Numbers
  1. strlen(http_build_query($_POST))
  2.  
http://php.net/strlen
http://php.net/http_build_query
Ya fine..

Its working well

Thank you
Oct 1 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Pierre Tremblay | last post by:
Hi! I am trying to display an image in my html document. The document contains the following line: <td class="Input"><img...
2
by: Bhavin G | last post by:
Hi there , I am pretty new at javascripting and i am having this huge problem. I am using asp.net and C# webapplication. In my asp.net aspx file I have a place holder for taking an html table...
27
by: Gene Ellis | last post by:
Something strange is happening, but I bet it is a quick fix. My favicon image is showing up in the URL bar, for a couple of seconds, but then it disappears and the default browser icon is...
18
by: lawrence | last post by:
If I'm pretty sure there is just one form on the page, can i do this? var myForm = document.forms; If I'm not sure about the form, is it safer to do this? if (document.forms) { var myForm =...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
1
by: Nuno Magalhaes | last post by:
I'm doing a "low level" project that consists on monitoring certain QoS parameters such as: Time to resolve dns, time to connect, time to receive data, time to receive all web page, time to close...
1
by: kamleshsharmadts | last post by:
I am using Ajax with struts in web application. from jsp i am calling a function of ajax.js onclick of a button. code of that call function which calling from jsp given as below:- ...
3
by: TC | last post by:
Hey All, I have some classes that I recently built for a website which uses the HttpWebRequest & HttpWebResponse objects from the System.Net namespace. Basically, the classes rap submitted data...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.