473,800 Members | 3,001 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can a form change session variables?

Hi,

In the first page I declare a session variable. Than, on the same
page, I make a form which contains a variable which has the same name
as the mentioned session variable. Pressing the "submit" button of the
form I go to the second page which immediately redirects me back to
the first page (with the "header"). And the mentioned variable does
NOT have the value which I have specified in the form.

It means, that session does NOT recognize the form variables as
session variables in spite on the fact that these variables have
identical names. Is that true?
Jan 13 '08 #1
22 4444
thanks to PHP's globals
Jan 13 '08 #2
On Jan 12, 9:54 pm, "Peter Pei" <yan...@telus.c omwrote:
thanks to PHP's globals
What do you mean?
Jan 13 '08 #3
On 13 Jan., 03:51, Kurda Yon <kurda...@yahoo .comwrote:
In the first page I declare a session variable. Than, on the same
page, I make a form which contains a variable which *has the same name
PHP does not automaticall register variables with your session.

Please review http://de.php.net/manual/en/ref.session.php for details.

Do you access your (expected) form/session variable like this:
$_SESSION['count'] ?
Jan 13 '08 #4
version? setting? did you ask? obviously possible
Jan 13 '08 #5
Kurda Yon wrote:
Hi,

In the first page I declare a session variable. Than, on the same
page, I make a form which contains a variable which has the same name
as the mentioned session variable. Pressing the "submit" button of the
form I go to the second page which immediately redirects me back to
the first page (with the "header"). And the mentioned variable does
NOT have the value which I have specified in the form.

It means, that session does NOT recognize the form variables as
session variables in spite on the fact that these variables have
identical names. Is that true?
It used to - there is a parm in the php.ini file called register_global s.

In earlier versions, this was enabled and would do what you want.
However, this is a huge security risk and has been disabled by default
in recent versions.

It's simple to get the variable from the session, though.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jan 13 '08 #6
On Jan 12, 9:57 pm, seaside <seaside...@mac .comwrote:
On 13 Jan., 03:51, Kurda Yon <kurda...@yahoo .comwrote:
In the first page I declare a session variable. Than, on the same
page, I make a form which contains a variable which has the same name

PHP does not automaticall register variables with your session.
What do you mean under "PHP ... register"? I have registered variables
by "session_regist er".
Please reviewhttp://de.php.net/manual/en/ref.session.php for details.

Do you access your (expected) form/session variable like this:
$_SESSION['count'] ?
No. I do like that:
session_start() ;
session_registe r("txt_l_1");
...........
print "<input type='text' name='txt_l_1' value=\"$txt_l_ 1\" >\n";
Jan 13 '08 #7
It's simple to get the variable from the session, though.
I do not mind if the user know all session variables there is only
HIS personal information. Or you mean "simple to get for the third
part"?
Jan 13 '08 #8
Kurda Yon wrote:
>It's simple to get the variable from the session, though.
I do not mind if the user know all session variables there is only
HIS personal information. Or you mean "simple to get for the third
part"?
The user has no knowledge of anything in the session (other than the
session name), since everything is on the server (and thus unavailable
to the user).

And yes, you stored the value in the session, so it's easy to retrieve
it from the session whenever you need it. It will be there until either
you clear it or the session is ended.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jan 13 '08 #9
register_global is actually broken in 5.2.5, set it to off and it still acts
as if on.

Jan 13 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
5103
by: TG | last post by:
Conditions: Register globals is set to on. Parse html as php is set to on. I have two forms OrderTest1 and OrderTest2 and need to be able to validate the data from OrderTest1 before passing to OrderTest2. The first block of code below is the first form. This form calls itself and does perform the validations correctly as I want. However, once the header redirect to OrderTest2.htm is performed after the isset($POST)) evaluates as true...
9
2408
by: Brian Burgess | last post by:
Hi all, Anyone know of any issues with setting the value of a Session object to the value of a submitted form item via 'Session("mySessionObj")=Request.Form("myFrmElem")' ? In my case the Session object gets set fine. But when the user links to another page, the value of the session object is EMPTY. thanks in advance..
3
5395
by: Harvey | last post by:
Hi, I try to write an asp query form that lets client search any text-string and display all pages in my web server that contain the text. I have IIS 6.0 on a server 2003. The MSDN site says there is a sample file called Ixtrasp.asp, but I could not find it in my system although I installed indexing service. I followed the steps in MSDN site to create a basic .asp query form (too long to post it here), but it always displays: No...
17
3310
by: Jim Little | last post by:
Hello, I'm driving myself crazy either because I'm missing something about ASP.NET, or what I'm trying to do simply can't be done. First, I am not using session variables to track state. My app will ultimately be web-farmed, so I resisted using either session variables. Second, what I'm trying to do is easy. What I'm trying to prevent seems impossible.
3
6183
by: hermand | last post by:
I've got an online job application I am building using ASP/VBScript. The application consists of one ASP document which has three separate states. States: 1. Form Display 2. Form Review (takes all information submitted from the first form state and removes the form elements and displays entered information using "Response.form()".
8
1733
by: Leszek | last post by:
Hi. I have two forms each in different file user need to fill both one after another. Is it possible to display variables from both forms at the end? does $_POST contains variables from both forms? If not what is the way to display variables from previous form?
26
2817
by: Jerim79 | last post by:
I need to create a form that takes a number that the user enters, and duplicates a question the number of times the user entered. For instance, if the customer enters 5 on the first page, when they press next the form generates "How old are you?" 5 times on the page. The customer will answer all 5 questions then press next. Finally, all the local variables get dynamically created and written to a database. I have already taken care of...
2
3119
by: FrankieBakerJr | last post by:
Hello I'm using ASP.NET 2003 on Windows XP SP2. I'm providing a web form that allows users to upload a document (xls, images, doc, pdf, etc) to the server. This part works fine, but after the form posts to the server, all of my session variables are cleared out. The Session.SessionID is not affected, but the rest are blank. How do i keep these values populated while using this upload method? <form name="form1" runat="server"...
15
2175
by: Kevin Davis | last post by:
Hello, I'm a new person when it comes to PHP and I have a quick question. I would like to create a form that will allow the user to add more information using the same form in case they have (similar to various employment sites). What would be the best way of using form arrays for that function?
0
9695
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9555
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10042
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...
1
7588
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
6826
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
5479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5616
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4156
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3770
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.