473,813 Members | 3,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating a reference to $_POST

63 New Member
Hi I am trying to understand a script and it has the following

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $postArray = array();
  3. if ( isset( $_POST ) )
  4. {
  5.    $postArray = &$_POST ;            // 4.1.0 or later, use $_POST
  6. }
  7. else
  8. {
  9.    $postArray = &$HTTP_POST_VARS ;    // prior to 4.1.0, use HTTP_POST_VARS
  10. }
  11.  
How does this work ... I am getting nothing when I display the postargs but the count of postargs is always 1.

Can anyone plz explain this to me
Oct 22 '07 #1
2 1120
pbmods
5,821 Recognized Expert Expert
Heya, Amolbehl.

So what you're saying is that when you print_r($postAr ray), it outputs an empty array, but when you echo count($postArra y), you get 1?
Oct 23 '07 #2
Atli
5,058 Recognized Expert Expert
Hi Amolbehl.

Just a thought.
If there is no POST data sent to the page when you are testing this, neither the $HTTP_POST_VARS array nor the $_POST super-global will contain any data, which will result in an empty array no matter what.
Oct 23 '07 #3

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

Similar topics

5
5215
by: R Duncan | last post by:
Hi, I'm considering moving a payroll application out of Microsoft Access to some web-based solution. It is getting way to big for Access and the system is growing unstable, so I'm learning PHP and MySQL and things are looking very promising. There is one piece of this I am having problems with. The attendance module shows users all their employees in a table and allows them edit it this way. My users need to be able to see and update...
14
4340
by: billy.becker | last post by:
I need to save a wav file that is HTTP POSTed to a php page. What does PHP5 do automatically to a POSTed variable when it puts it in the $_POST superglobal array? I haven't been able to find any info on this.... I have a script that does what I want in PERL, but I need to do it in PHP. I think the PERL does something magic when it does this:
0
1211
by: LS | last post by:
1. When I select an assignment, the class roster disappears. I don't want it to show up until I select an assignment. 2. I want to be able to enter grades and submit all with only one submit button. This is my code (file is loaded at http://lynnesmith.net/teacher/entergrades.php): +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <HTML>
1
1393
by: LS | last post by:
1. When I select an assignment, the class roster disappears. I don't want it to show up until I select an assignment. 2. I want to be able to enter grades and submit all with only one submit button. This is my code. File is loaded at http://lynnesmith.net/teacher/entergrades.php +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ <HTML> <HEAD> <TITLE>Gradebook</TITLE> <LINK REL="STYLESHEET" TYPE="text/css"...
6
1964
by: ste | last post by:
Hi there, I'm just beginning to learn PHP and MySQL, but I'm finding it difficult! I wondered if someone could help me out with a problem I'm having, or at least point me in the right direction? I have setup a MySQL database which contains the following, though I would like to expand on this in the future with lots of extra fields: IMAGES TABLE: -------------------
2
3827
by: RottNKorpse | last post by:
Well I am trying to make an admin section to allow my other admins of my site able to add content to my mysql database without giving them phpmyadmin access and without teaching them out to use it as well. So I am trying to make a form that they can use to fill in a few simple fields and then it create the tables in the database and then insert a row in a seperate table that is already made. Here is how I want it to work... Name: Filename:...
4
2052
epots9
by: epots9 | last post by:
would it be possible to pass the contains of a $_POST reference to another page without submitting the form? I have a page which using $_POST to fill up some of the fields, and i have a print button that re-open the same exact page in a new window (javascript), without all the buttons, icons, etc. for a printer-friendly page, but since i'm not submitting the page the $_POST references are lost...how can i get around this? **i'm trying to...
4
6710
by: atiq | last post by:
I basically have a mail to form on my website. When the form is filled and submitted by the user it processes the form using the file feedback.php. What i want is a Pop up window which says "thank you for your Feedback" for 5 second and then goes back to the home page... Below is the code for the feedback.php <?php /* CHFEEDBACK.PHP Feedback Form PHP Script Ver 2.08 Generated by thesitewizard.com's Feedback Form Wizard. ...
2
2122
by: divyac | last post by:
I have developed an address book using php and mysql.I have all the contacts list in a table with check boxes.Now that i want to create mailing labels for the checked contacts...i.e.,the arrangements of addresses should be modified in such a way that there should be 5 addresses in a row of the table...I have done some coding but just dont know how to retrieve the checked contacts..Also..i have some problem in creating labels in which some...
0
10665
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10406
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10420
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10139
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9221
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7681
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5704
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3029
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.