473,804 Members | 2,190 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Data Loss

I have recently started experiencing form data loss. Here is an
example:

====test_form1. php====

<form method="POST" action="test_fo rm2.php">
<input name="textboxva lue" type="text" size="20">
<br>
<input type="submit" value="Submit">
</form>

=============== =======
====test_form2. php====
<?
echo "textboxval ue: ".$textboxvalue ;
?>
=============== =======

(note: these are incomplete examples, I have left out the <html> tags
for example)

After putting in data into the textboxvalue textbox and pressing the
submit button, on the second page only "textboxval ue: " is displayed.
The weird thing is that when I restart my computer, this works fine,
but then stops working again. These pages are encrypted with 128 SSL
encryption (mod_SSL 2.8.15).

This problem has plagued an online app that I am developing and is a
company-wide problem that happens on computers in other offices too.

Here's my info:

SERVER
Apache 1.3.28
PHP 4.3.6
MySQL 3.23.39
mod_SSL 2.8.15
phpMyAdmin 2.50

CLIENT
Windows XP Pro
Internet Explorer 6.0.28
Jul 17 '05 #1
14 3178
On 21 Jun 2004 10:03:55 -0700, kc**@issllc.com (smilemaster) wrote:
====test_form2 .php====
<?
echo "textboxval ue: ".$textboxvalue ;
?>
============== ======== submit button, on the second page only "textboxval ue: " is displayed.


i suppose you have turned off "register_globa ls" in your php.ini
Either turn it on or use the $_POST Array (which is the better
solution):

echo "textboxval ue: ".$_POST['textboxvalue'];

Regards
Marian
--
Tipps und Tricks zu PHP, Coaching und Projektbetreuun g
http://www.heddesheimer.de/coaching/
Jul 17 '05 #2
Sorry for such a newbee question, but why is using the $_Post Array
better?

Also, I checked "register_globa ls" and it is set to "On" both for the
"Local Value" and the "Master Value".

Thanks,

-Karl

Marian Heddesheimer <20************ *@spamgourmet.c om> wrote in message news:<ek******* *************** **********@4ax. com>...
On 21 Jun 2004 10:03:55 -0700, kc**@issllc.com (smilemaster) wrote:
====test_form2 .php====
<?
echo "textboxval ue: ".$textboxvalue ;
?>
============== ========

submit button, on the second page only "textboxval ue: " is displayed.


i suppose you have turned off "register_globa ls" in your php.ini
Either turn it on or use the $_POST Array (which is the better
solution):

echo "textboxval ue: ".$_POST['textboxvalue'];

Regards
Marian

Jul 17 '05 #3
smilemaster (kc**@issllc.co m) wrote:
: I have recently started experiencing form data loss. Here is an
: example:
: CLIENT
: Windows XP Pro
: Internet Explorer 6.0.28

I could be way off base, but I seem to recall reading about exactly this
problem with IE. For whatever reason, under certain conditions it doesn't
send the data from the form to the server.

Is it possible that the version of IE has changed recently? If other
things changed, such as whether http was changed to https, then this would
also explain why you see it now and not before, but even then, the problem
could be IE.

I would try the pages using another browser to see it that changes
anything.

$0.02
Jul 17 '05 #4
smilemaster wrote:
I have recently started experiencing form data loss. Here is an
example:
and Marian Heddesheimer replied:i suppose you have turned off "register_globa ls" in your php.ini


smile: Marian's answer is almost certainly the correct one. Especially
since you report that this is something you "recently started
experiencing". Check with your server admin and ask if they recently
upgraded the machine to a newer version of php or whatever unix flavor
os it's (presumably) got. I believe that php 4.2.0 was the first
revision where register_global s is turned off by default.

I discovered this the hard way by working through a Wrox book on php.
register_global s is a php.ini setting that allows all variable values
passed through either forms or urls to be recognized as global variables
by default. Well, this creates all sorts of security problems which is
why it's normally recommended that you turn this feature *off* in the
php.ini. When you do this, it means that if you want to access a value
passed through a form field, you must access it through either the POST
or REQUEST global arrays, and if you want to access a value passed
through a url, you must access it through either the GET or REQUEST
global arrays, thus:

//value passed through form field text box named 'myfield'
$myvalue=$_POST['myfield'];

//value passed through url, i.e.,
//"http://www.myurl.net/test.php?myfiel d=myvalue"
$myvalue=$_GET['myfield'];

Not only that, but if you need to pass any values acquired in this
manner to a function, they need to be explicitly declared as global
within the function, thus:

function myFunctionName () {
global $myvalue;
}

See the following errata page from Wrox for an explanation (refer to the
second entry on the errata listing):
http://www.wrox.com/books/errata/076...4_errata.shtml

Also see the following documentation on www.php.net (be sure to scroll
to the bottom of the page to the section headed 'SECURITY: NEW INPUT
MECHANISM'):
http://www.php.net/release_4_1_0.php

Also see this page and refer to the big box headed 'Warning':
http://us4.php.net/variables.predefined

As you can see, as of revision 4.2.0, register_global s is turned *off*
by default, and you absolutely should leave it that way. Just revise
your code per the examples above.

Jul 17 '05 #5
I checked my phpinfo() page and "register_globa ls" is set to "On" both
for the "Local Value" and the "Master Value".

Also, I updated my test pages with a $_POST reference, here ya go:

===test_form1.p hp===
<form method="POST" action="test_fo rm2.php">
<input name="textboxva lue" type="text" size="20">
<input type="submit" value="Submit">
</form>

===test_form2.p hp===
<?
echo "textboxval ue: ".$textboxvalue ;
echo "<br>textboxval ue (Post Array): ".$_POST['textboxvalue'];
//<--NEW
?>

Again, these codes samples are incomplete for clarity's sake (for
example I've left out the <HTML> tages).

I contacted the company that hosts the pages for me (Yahoo!
Webhosting) and because the above pages were working at the time they
tried them, they could not replicate my problem and therefore refused
to help further.

The super weird thing about this problem is that it only happens
*sometimes*. Like today I've been working on the PHP app I am
developing and it's worked fine except for on two occasions when it
stopped working and I had to reboot.

Another fact to add to the "super weird" file is that when this
problem starts, it occurs in multiple types of browsers. When it
started last time I tried the above test pages in IE6.0, Mozilla, and
Opera with the *same* results in all of them (it didnt work).

Also, like I said before, this problem has happened across my company
at computers in different offices with different ISPs. The only
corrolation I can think of is that all of the machines we have run XP
Pro.

I'm about to pull my remaining hair out! :-(
Jul 17 '05 #6
smilemaster wrote:
I have recently started experiencing form data loss. Here is an
example:

====test_form1. php====

<form method="POST" action="test_fo rm2.php">
<input name="textboxva lue" type="text" size="20">
<br>
<input type="submit" value="Submit">
</form>

=============== =======
====test_form2. php====
<?
echo "textboxval ue: ".$textboxvalue ;
?>
=============== =======

(note: these are incomplete examples, I have left out the <html> tags
for example)

After putting in data into the textboxvalue textbox and pressing the
submit button, on the second page only "textboxval ue: " is displayed.
The weird thing is that when I restart my computer, this works fine,
but then stops working again. These pages are encrypted with 128 SSL
encryption (mod_SSL 2.8.15).

This problem has plagued an online app that I am developing and is a
company-wide problem that happens on computers in other offices too.

Here's my info:

SERVER
Apache 1.3.28
PHP 4.3.6
MySQL 3.23.39
mod_SSL 2.8.15
phpMyAdmin 2.50

CLIENT
Windows XP Pro
Internet Explorer 6.0.28


what OS is the server running?

Michael Austin.
Jul 17 '05 #7
The server is running FreeBSD 4.8

-Karl

Here's my info:

SERVER
Apache 1.3.28
PHP 4.3.6
MySQL 3.23.39
mod_SSL 2.8.15
phpMyAdmin 2.50

CLIENT
Windows XP Pro
Internet Explorer 6.0.28


what OS is the server running?

Michael Austin.

Jul 17 '05 #8
Bathroom_Monkey wrote:
Here's my info:

SERVER
Apache 1.3.28
PHP 4.3.6
MySQL 3.23.39
mod_SSL 2.8.15
phpMyAdmin 2.50

CLIENT
Windows XP Pro
Internet Explorer 6.0.28


what OS is the server running?

Michael Austin.


The server is running FreeBSD 4.8

-Karl

Okay, there have been several suggestions about turning on error
checking. What did that yield?

With the latest version of PHP (4.3.something) I started using the
following code at the top of all of my scripts just to make sure I get
all of the variables...

<?php
// comment the following lines to turn off error messaging
error_reporting (E_ALL);
ini_set('displa y_errors', 1);
if (!empty($_GET))
{
extract($_GET);
}
else if (!empty($HTTP_G ET_VARS))
{
extract($HTTP_G ET_VARS);
}
if (!empty($_POST) )
{
extract($_POST) ;
}
else if (!empty($HTTP_P OST_VARS))
{
extract($HTTP_P OST_VARS);
}
......
?>

But before you do change test_form2.php to:

<?
echo "POST textboxvalue: ".$_POST["textboxval ue"]; //more transportable
echo "GET textboxvalue: ".$_GET["textboxval ue"]; //coding style.
?>

What does this give you??
Michael Austin.
Jul 17 '05 #9
Error checking has yielded very little. After adding the GET
statement to the php code, here is what the error message is when this
problem is occuring:

=============== =============== ======
Notice: Undefined variable: textboxvalue in
/ssl/TEST_nb_TEST/test_form2.php on line 39
textboxvalue:
Notice: Undefined index: textboxvalue in
/ssl/TEST_nb_TEST/test_form2.php on line 43
textboxvalue (Post Array):
Notice: Undefined index: textboxvalue in
/ssl/TEST_nb_TEST/test_form2.php on line 44

GET textboxvalue:
=============== =============== ======
In this revision of fixing this problem, here is what my code looks
like in test_form2.php:
=============== =============== ======
<?
// comment the following lines to turn off error messaging
error_reporting (E_ALL);
ini_set('displa y_errors', 1);
if (!empty($_GET))
{
extract($_GET);
}
else if (!empty($HTTP_G ET_VARS))
{
extract($HTTP_G ET_VARS);
}
if (!empty($_POST) )
{
extract($_POST) ;
}
else if (!empty($HTTP_P OST_VARS))
{
extract($HTTP_P OST_VARS);
}

?>

<html>

<head>
<meta name="GENERATOR " content="Micros oft FrontPage 5.0">
<meta name="ProgId" content="FrontP age.Editor.Docu ment">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>TEST FORM PAGE 2</title>
</head>

<body>
<br><br>
<?
echo "textboxval ue: ".$textboxvalue ;

echo "<br><br>";

echo "textboxval ue (Post Array): ".$_POST['textboxvalue'];
echo "<br>GET textboxvalue: ".$_GET['textboxvalue'];
?>
</body>

</html>

=============== =============== ======
Jul 17 '05 #10

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

Similar topics

1
714
by: Bathroom_Monkey | last post by:
I have recently started experiencing form data loss. Here is an example: ====test_form1.php==== <form method="POST" action="test_form2.php"> <input name="textboxvalue" type="text" size="20"> <br> <input type="submit" value="Submit"> </form>
1
8045
by: teknowbabble | last post by:
I would like to know how to convert HTML code that users input into a TEXTAREA box on a HTML FORM into a separate WEBPAGE. I have something like the diagram below on my webpage. The user is prompted to input his/her HTML Code in the FORM TEXTAREA. By pushing the Make Webpage Button, a new window opens with the output of the HTML contents they inputted. This way people can see what their HTML looks like. HTML FORM TEXTAREA (Where user...
1
2866
by: db_guy | last post by:
Hi, we have a php-based application that is hosted by Yahoo! Webhosting. Ever since the application was created, it has been plagued by periodic session data loss. Here's a typical example: We will successfully input 7 clients into the system, but upon submitting the 8th, all session data fails to enter the MySQL database. After viewing the record in the database, the row is empty except for data that was not stored in a session. I...
0
1547
by: sid | last post by:
Data loss in Access-97 from VB 6.0 I have encountered Random data loss in our access database. Sometimes the users call in saying that the records entered by them are lost. The users, use our VB front end to enter the data (Users do not enter data directly into the database) Most of the times I have noticed that the problem occurs when users add new records. All our tables have a unique alpha-numeric primary key.
7
2298
by: Neil Ginsberg | last post by:
I'm having some problems with an Access 2000 MDB file with a SQL Server 7 back end, using ODBC linked tables. I previously wrote about this, but am reposting it with some additional information and in summary form, in hopes that someone might have an idea about what's going on. I am using a bound form which is losing data a significant portion of the time. Basically, the form contains 6 fields and three subforms, as follows: Field A...
5
6803
by: Sharon | last post by:
I have encountered with a most disturbing TCP problem: I have cases (too many of them) that result in data loss. Some inforamation on my test configuration: I have to PC's which are the same (Dell Dimension 2400). PC1 is the tcp server, PC2 is the tcp client, they two configured to 65535 bytes tco buffer/window, and working in synchronous manner while for each client the server start a dedicated thread. The client send the data size in...
4
1411
by: nalls | last post by:
Hi, I am experiencing data loss while submitting the form. After submitting the form, the data goes to the next page( a .php file) where it has to be encrypted and inserted into the database. But the encryption function gets only a blank space. Can any one help me?
12
3650
by: elliot.li.tech | last post by:
Hello everyone, I'm migrating a C++ program from 32-bit systems to 64-bit systems. The old programmers used some annoying assignments like assigning "long" to "int", which may lead to data loss. Is it possible to let the compiler (specifically, GCC) spew some warnings on this kind of implicit type casts? Or you suggest use some other static source codes analysis tools?
3
1730
by: rahulj | last post by:
I am trying to insert data from one table to another using the query below INSERT INTO SORT_KEY_TEMP2 (SELECT * FROM SORT_KEYS ORDER BY SK_PAGE_ID FETCH FIRST 100 ROWS ONLY); Table SORT_KEY_TEMP2 Name Data type Length Nullable SK_PAGE_ID CHARACTER 8 Yes SK_LAUNCH_DATE TIMESTAMP 10 Yes SK_LIST_TYPE CHARACTER 1 Yes
0
9714
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...
1
10351
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
10096
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
7638
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
6866
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
5534
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
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
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.