php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21192 Problems with variables
Submitted: 2002-12-26 06:54 UTC Modified: 2003-01-06 12:29 UTC
From: vieste dot perugia at tiscali dot it Assigned:
Status: Not a bug Package: Performance problem
PHP Version: 4.2.3 OS: Windows XP Home Ed
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
45 + 23 = ?
Subscribe to this entry?

 
 [2002-12-26 06:54 UTC] vieste dot perugia at tiscali dot it
Dear Sirs,

I have recently installed PHP v.4.2.3 on a Windows XP Home Edition system equipped with an Apache HTTP Server v.1.3.24 and MySQL v.4.0.3.

I believe the installation was completed successfully since I have already managed to create simple databases with PHP and MySQL and insert, update and delete tables and records.

In spite of this, I have encountered a problem dealing with variable settings that is literally driving me crazy. I'll try to explain it in very few words.

If I populate a table using the following code, everything works perfectly:

//***START OF CODE***
@mysql_connect("localhost", "root", "") or die ("Sorry. Could not connect to the DB!");
@mysql_select_db("mydb") or die ("Sorry. Coluld not open the DB!");           
@mysql_query("insert into mytable (field1,field2) values ('First field value','Second field value')") or die("Sorry. Could not insert data!");
//***END OF CODE***

Nevertheless, if I try to specify the field values by means of variables corresponding to the values of text boxes, the variables are not recognized by PHP and I get an error message. So the problem is, I can't import variables from text boxes!

In order to simplify what I mean, the following basic code, saved in a file called "test.php", originates an error on my system:

//***START OF CODE***
<input type="text" name="mytext" value="Hello world!">

<?php

echo "$mytext";

?>
//***END OF CODE***

When I execute the code above, all I get is the following error message:

Notice: Undefined variable: mytext in c:\program files\apache group\apache\htdocs\test.php on line 5

I would very much like to understand the reason why such elementary lines of code don't work on my system. Please if you have the answer to my question, help me. If possible, notify me at the following e-mail address:

vieste.perugia@tiscali.it

Thanks in advance for your help.

Yours faithfully,

Pasquale Esposito
Perugia (Italy)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-26 06:57 UTC] tal@php.net
In PHP 4.2.0, the 'register_globals' setting default changed to
'off'. See http://www.php.net/release_4_2_0.php for more info.
We are sorry about the inconvenience, but this change was a necessary
part of our efforts to make PHP scripting more secure and portable.
 [2003-01-06 09:19 UTC] lucaalv at tiscalinet dot it
Dear sirs, 
I have the same problem of Pasquale. I have already changed the parameter "register_globals on" but my script doesn't recognize the variables passed from the form with GET method.
PHP v.4.2.3 and APACHE 1.3.27 on Windows XP
Can you help me? Thank you! 
LUCA ALVISI
 [2003-01-06 12:29 UTC] vieste dot perugia at tiscali dot it
Thank you very much for your help. I have changed the 'register_globals' setting and everything has fallen into place. Anyway, I also had to use the POST method to make it work.

Best regards.

Pasquale Esposito
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC