Click here to get back home

Re: Trying to change global array value with $POST

 HomeNewsGroups | Search

comp.lang.php - PHP programming language discussions 

get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Re: Trying to change global array value with $POST VaryingHare 09-07-2009
Posted by VaryingHare on September 7, 2009, 6:02 pm
Please log in for more thread options


Thanks for the timely response. Here are my additional thoughts.

First, you are correct these files are not boiled down all the way,
but these were the program parts as I wrote them eliminating what I
thought was necessary. Each php file is much much larger than that
shown. I did not consolidate to one file because I thought it would
effect the question or the answer to the problem.

Second, you ware correct that I meant to type bx3init.php not
bk3init.php. The contents are correct however.

Third, yes, a blank is displayed when no choice is made off the option
list, but that is not really the issue. The starting value is still 5
even when the ending value is input to change to 1, 2, 6, or left
blank. How do we get the starting value to change, so that the new $B
[5] value can be used everywhere? In your version as well as mine,
when I hit submit, the screen stays pretty much the same with the
starting value unchanged, the ending value set equal to the option
previously selected, the option list displayed with no highlighted
choice, and I can immediately choose another value. $B NEVER
changes here. However, I want the starting value of $B[5] to change as
well as its ending value. Does $B get initialized every time or can
we get it to initialize only the first time through? Maybe, I don't
understand the processing of php files. Does the code get processed
continuously top line down to last line or does it just sit there
waiting for something to happen--like clicking on the SUBMIT?

Appreciate your help.

Posted by Jerry Stuckle on September 7, 2009, 6:20 pm
Please log in for more thread options


VaryingHare wrote:
show/hide quoted text

Web processing is transactional in nature. When the client requests a
web page, the server fetches it. If the page contains server side code
(PHP or any other language), that code is executed. The output from the
page is then sent to the client and any running scripts terminate.

When the next page is requested (or the same page is requested again),
the process starts all over again. Nothing is saved from the previous
execution; if you want something to be saved, you must do it yourself,
i.e. in a database, cookie or the session storage.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Posted by Captain Paralytic on September 7, 2009, 6:24 pm
Please log in for more thread options


show/hide quoted text
5
show/hide quoted text
B
show/hide quoted text
e
show/hide quoted text

Carrying on from what Jerry has said, web processing is generally what
is know as "stateless", unless you store the user state somewhere
(i.e. in a database, cookie or the session storage.)

Posted by VaryingHare on September 7, 2009, 10:47 pm
Please log in for more thread options


Thanks guys.

I think I understand the concept a little better now. I wanted to
make the PHP code more or less self-contained. I really only know
HTML, mySQL and some PHP in the new Windows world. I am a COBOL,
Fortran, Basic, dBase, WordStar, CP/M, DOS kind of guy. I will go
back to the drawing board to learn how to make this work. I need to
save variables between the various user inputs entered from time to
time to make an online application function properly in real time.

I appreciate all your generous input and comments.

Posted by Peter H. Coffin on September 8, 2009, 8:57 am
Please log in for more thread options


On Mon, 7 Sep 2009 19:47:33 -0700 (PDT), VaryingHare wrote:
show/hide quoted text

One thing that often helps is to remember that there's two different
"viewpoint" from which to look at PHP-writing. One way is "smart web
pages" that are HTML with snippets of PHP code mixed into them, which is
what your examples looked like they were trying. The other (which I
found a lot easier and it seems many people coming from other
programming backgrounds do as well) is that PHP is a programming
language that one uses to generate HTML pages. So, you go from:

show/hide quoted text
        <?php require_once('func_lib.php');
show/hide quoted text

to something more like

<?php
require_once('func_lib.php');
session_start();
require_once('page_head.htmlseg');

show/hide quoted text
/* fetch db results */
show/hide quoted text

require_once('page_foot.htmlseg');
show/hide quoted text

They both work similarly and spit out the same results, but they're
different ways of approaching the task.

--
The pig is nothing but a giant dish which walks while waiting to be served.
         --Grimod de La Reynière

Similar ThreadsPosted
php.ini is output_buffering effected after Global Variables change? July 30, 2005, 1:52 am
5.2.2 and POST data change? May 15, 2007, 11:17 am
Problems with post/get - while Global-Registers are "on"! August 22, 2004, 6:02 am
global array? March 25, 2009, 3:13 pm
Global array for application config? November 5, 2004, 2:15 am
$post array has nothing in it May 9, 2009, 5:51 am
Variable passed in GET or POST array January 18, 2006, 11:17 pm
Post array values (beginner's question) September 27, 2005, 5:22 pm
how does PHP5 process POST data in creating $_POST array? May 9, 2005, 7:09 pm
using global var (global settings?) June 19, 2006, 12:56 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Driving a better car - Fuelzilla.com

Cabling site for homeowners and pros alike - Cabling-Design.com

Friends:

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap
Privacy Policy