Learn PHP
Site Map
PHP
HTML
Authentication
Php Functions
C++ - Starting Out
Web Design Tools
Photoshop Tutorials
Windows
Phones
Droid Phones
Building Websites
ArrowTech Blog
Web Servers
Networking
Making Money
Favorite Links
About
ObamaCare
Software
Privacy Policy

Category: php

.

Visual example of how PHP handles the super-global array variable "$_POST"

Author: D.Shaun Morgan

Versions and Skill Level
  • PHP Version - PHP 5x
  • Reader skill level - Beginner
  • XHTML 1.0 Transitional - interchangeable with HTML 4.0
See Also:
  1. How can I pass a PHP variable from one page to another

Imagine that an array-name like the one I am using here, "$_POST," is a bookcase. On this bookcase there is the possibility for one or more shelves to be built. Each shelf will have the same name of whatever we store on it. How many shelves we build and what we name them depends on what we call the stuff, how much stuff we need to store, and how we go about storing it.

Now lets say that what we want to store is a miniature bookcase labeled "$first_name." In this instance we know that our miniature bookcase has five shelves labeled 0 - 4, from top to bottom.

Notice that $_POST is an array. The miniature bookcase in this example is also an array. Thus, we are storing an array inside of an array in PHP.

$_POST

$first_name
0--a
1--b
2--c
3--d
4--e


Say I need to use trinket "b." To get trinket "b" from the miniature bookshelf "first_name" located on bookshelf "$_POST," I will do the following:

$first_name = $_POST['first_name'];
$trinket_b = $first_name[1];


Now, I'll write a line of PHP that will print-to-screen what I retrieved from "$first_name" -- shelf number 1.

^?php

$first_name = $_POST['first_name'];

$trinket_b = $first_name[1];

echo $trinket_b;

?*
Note that I could have just as easily written

^?php

echo $_POST['first_name'];

?*


and produced the same result. Sometimes, that is even the best way to do it

The example above, while far from complete, provides a basic way of thinking about arrays. The same idea can be applied to the other super globals -- $_GET, $_SESSION, and $_COOKIE.

Author: D.Shaun Morgan

convert timestamp to readable date time using php Convert Unix Timestamp to Readable Date Time PHP User Function string function convert_timestamp(string $file_in

creating image watermarks Creating PHP Watermarks $my_image = imagecreatefromjpeg('photo.jpeg'); $watermark = imagecreatetruecolor(100

need to print out an array using php How toPrint PHP Arrays Things to Consider Are: Array Type- Single Array or Multidimensional Array

php      

odd number php script Testing for Odd/Even Numbers - PHP Example Banner Rotation PHP Script Odd/Even Numbers The easiest way to setup an Odd / Even test using PHP i

how to upload images and files using php Upload Images to Webserver HTML Form PHP Function # UPLOAD FILE function upload_file(){ echo '

using php cookies variables Using Cookie Variables in PHP Setting cookies in php is pretty straight forward. There is a php function: setcookie(); This function mu

how to unzip files on your free hosting account Uzipping Files on Your Web Server If you are using a free hosting account with godaddy.com and many of the other Free hosts out there, you may have found that they don't offer you a lot o

passing data from one form to another form using php Passing data from one form to another form To pass php data from a form and then catch that data into another form one way to accomplish this task is to intermi

Just In Time Compiling JIT - Just in Time Compilers JIT refers to a special software that is found in web-browsers, and scripting engines such PHP's Zend. (My understanding of ZEND is that it

Storing image locations mysql Store Image URL in Database Retrieve Image with PHP Script

how to turn variable value into variable name Variable Variables in PHP Every so often when you are writing a php file, we all run into a situation where we would like for the name of the string that is inside

what-is-php Explanation of PHP Basic Syntax --New to PHP Php is a language that is very much like writing c. The best feature of PHP versus c is that it is designed pri

how to use dreamweaver Dreamweaver - WISIWIG Dreamweaver is a tool that arguably could be called the industry standard for web design . Dreamweaver, is an Adobe product that originally b

Filezilla Filezilla Ftp Client, FTP SERVER vs Wsftp By: D.Shaun Morgan While I was writing this article, about halfway through, I realized that it would be unfair to tell my readers about

notepad plus Notepad++ Download Notepad Plus Plus Notepad plus plus is an open source, free text editor. It is

how to open create write files using php Php file functions, Opening a file in php, reading a file in php, writing a file in php In this tutorial we will look at the most commonly used file functions used in php. The

stop form spam captcha PHP -- How to Protect My Email Form / Contact Form Against Spam Bots Author: D.Shaun Morgan Versions and Skill Level PHP 5

retreive images mysql using php How to get images out of mysql database with php and use them on my webpages Author: D.Shaun Morgan PHP Version - PHP 5x

how to make money online Making Money on the Internet Sign up for this series of free money making articles Name:

store images mysql using php Storing Images in Mysql Database Tutorial Outline: Creating a Test Mysql Database Example php Database Functio

php example post array Visual example of how PHP handles the super-global array variable "$_POST" Author: D.Shaun Morgan Versions and Skill Level

php arrays Passing PHP Arrays How to pass php variable arrays between pages. Author:

how to write php functions Explanation of a Basic PHP Function What is a PHP function? In PHP a function represents a block of instructions that perform

how to write html form using php When learning PHP to build a website, one of the very first things that any newcomer, or beginner needs to learn is how to use HTML or XHTML (both will mean the same for this tutorial.) fo

register globals long arrays Security, php.ini, register_globals and register_long_arrays Author: D.Shaun Morgan Versions and Skill Level PHP Version - PHP 5x

how to install php 5 How to Install PHP 5.x.x.x on Windows This is beginner's how-to manual explaining how to quickly setup a PHP 5 installation on a Windows PC. You must have an Apache webserver installed

php passing variables Pass Variables from One Page to Another -- PHP Author: D.Shaun Morgan Tutorial Outline : Passing PHP variables with $_

.

Leave a Comment

php_example_post_array.php

Name:      | Email:      | Website:

Comment:


captcha

Enter The Above Security Code:


Author: ward | Website URL: www.telerex-europe.com |
Comment:
Hello,

How do I do the complete opposite of this tutorial?

I have a given number of values out of a select , generated by a FOR loop:
Through this I m able to generate a string with DOCUMENT.WRITELN, but I want to get this string into a TEXTBOX, without leaving the page...
After completing the form which has more values to enter I want to pass this TEXTBOX value as a single string to the database...

How can this be done?

Thanks in advance,

Bye
Ward


Re: Admin



Ok Ward, it sounds like you are talking about using javascipt to validate a form OR you are asking me how you can take the info you got out of a database or some other place and populate your textboxes with that data.

I am stabbing in the dark here but I am assuming that you somehow passed some variables to the page with your form on it or you populated some local variables that were created on the page in question with some other source of information and you want to place all those values into your form and then submit it.

When I want to pupulate my forms with variables from the script that runs on the same page , I simply echo the variable's values into the value attribute of an input or in between the opening and closing textarea tags like so:

$varTest = 'Data that you Retrieved";


<input type="text" name="var01" value="<echo varTest; ?>" />

or

<textarea name="var01" ><?php echo $varTest;</textarea>

Either of these options will place the values of your script variables into your form objects

When you submit this form those variables will go on to be processed on the page pointed to in the form action attribute.
Author: heli | Website URL: |
Comment:
Please.. Clearly define what is the meaning and use of super global arrays ????




Re: Admin


http://mrarrowhead.com/index.php?page=php_example_post_array.php