forms and method POST - variables

------=_NextPart_000_0046_01C852E4.A5247470
Content-Type: text/plain;
charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

Hi,

I have one question about forms and php (which I use for Mysql too).

Do I need for variables from any form in html and method POST (then in =
php
script) to set these variables with:

$variable=3D$_POST['variable'];



For example:

<html>

<head>

<title> FORM</title>

</head>

<body>

<form action=3D"do_something.php" method=3D"POST">

Input something

<br>

<input type=3D"text" name=3D"variable">

<input type=3D"submit" value=3D"submit">

</FORM>

</body>

</html>



And then.in do_something.php



<html>

<head>

<title>DO SOMETHING</title>

</head>

<body>

<?php

$variable=3D$_POST['variable'];

echo "<br><b>Variable: </b>".$variable;

?>

</body>

</html>



Because I got some old scripts where I don=B4t have this setting.they =
worked
on MS Win2000 - PWS and PHP 4.0 but now - with Apache 2.2.6, PHP 5.2 on =
WIN
XP it doesn=B4t work.



Thank you for any advice.



Lukas


------=_NextPart_000_0046_01C852E4.A5247470--
moravec [ Mi, 09 Januar 2008 17:25 ] [ ID #1903893 ]

RE: forms and method POST - variables

Well, it depends if you use an old version of PHP, in the latest version
both arrays $_POST and $_GET are used to get passed variables!!
I can't remember since what version PHP started to use these arrays!!

MG

-----Original Message-----
From: Luká¹ Moravec [mailto:moravec [at] ptvservis.cz]
Sent: Miércoles, 09 de Enero de 2008 10:26 a.m.
To: php-db [at] lists.php.net
Subject: [PHP-DB] forms and method POST - variables


Hi,

I have one question about forms and php (which I use for Mysql too).

Do I need for variables from any form in html and method POST (then in php
script) to set these variables with:

$variable=$_POST['variable'];



For example:

<html>

<head>

<title> FORM</title>

</head>

<body>

<form action="do_something.php" method="POST">

Input something

<br>

<input type="text" name="variable">

<input type="submit" value="submit">

</FORM>

</body>

</html>



And then.in do_something.php



<html>

<head>

<title>DO SOMETHING</title>

</head>

<body>

<?php

$variable=$_POST['variable'];

echo "<br><b>Variable: </b>".$variable;

?>

</body>

</html>



Because I got some old scripts where I don´t have this setting.they worked
on MS Win2000 - PWS and PHP 4.0 but now - with Apache 2.2.6, PHP 5.2 on WIN
XP it doesn´t work.



Thank you for any advice.



Lukas

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
MIGUEL ANTONIO GUIRAO [ Mi, 09 Januar 2008 17:36 ] [ ID #1903894 ]

Re: forms and method POST - variables

T24gSmFuIDksIDIwMDggMTE6MjUgQU0sIEx1a+G5IE1vcmF2ZWMgPG1vcmF2 ZWNAcHR2c2Vydmlz
LmN6PiB3cm90ZToKPiBIaSwKPgo+IEkgaGF2ZSBvbmUgcXVlc3Rpb24gYWJv dXQgZm9ybXMgYW5k
IHBocCAod2hpY2ggSSB1c2UgZm9yIE15c3FsIHRvbykuCj4KPiBEbyBJIG5l ZWQgZm9yIHZhcmlh
YmxlcyBmcm9tIGFueSBmb3JtIGluIGh0bWwgYW5kIG1ldGhvZCBQT1NUICh0 aGVuIGluIHBocAo+
IHNjcmlwdCkgdG8gc2V0IHRoZXNlIHZhcmlhYmxlcyB3aXRoOgo+Cj4gJHZh cmlhYmxlPSRfUE9T
VFsndmFyaWFibGUnXTsKW3NuaXAhXQoKICAgIFRoYXQncyBhIHF1ZXN0aW9u IHRoYXQgc2hvdWxk
IGJlIGFza2VkIG9uIHRoZSBQSFAtR2VuZXJhbCBsaXN0LAphY3R1YWxseS4g IEknbSBmb3J3YXJk
aW5nIHRoZSByZXNwb25zZSB0byB0aGF0IGxpc3Qgd2l0aCB0aGlzIG1lc3Nh Z2UuCgogICAgQXJl
IHlvdSByZWNlaXZpbmcgYW55IGVycm9ycz8gIEFyZSBhbnkgbWVzc2FnZXMg ZGlzcGxheWVkIHdo
ZW4geW91CmhhdmUgdGhlIGZvbGxvd2luZyBhdCB0aGUgYmVnaW5uaW5nIG9m IHRoZSBzY3JpcHQ/
CiAgICA8P3BocAogICAgICAgIGVycm9yX3JlcG9ydGluZygiRV9BTEwiKTsK ICAgID8+CgogICAg
JF9HRVQgYW5kICRfUE9TVCBhcmUgcHJlZGVmaW5lZCBzdXBlcmdsb2JhbCB2 YXJpYWJsZXMsIHdo
aWNoIGhhdmUKYmVlbiBhdmFpbGFibGUgaW4gUEhQIHNpbmNlIGRpbm9zYXVy cyByb2FtZWQgdGhl
IEVhcnRoLgoKLS0gCjwvRGFuPgoKRGFuaWVsIFAuIEJyb3duClNlbmlvciBV bml4IEdlZWsgYW5k
ICMxIFJhdGVkICJZZWFyJ3MgQ29vbGVzdCBHdXkiIEJ5IFNlbGYgU2luY2Ug MTk3OS4K
parasane [ Mi, 09 Januar 2008 19:38 ] [ ID #1903895 ]

Re: forms and method POST - variables

> Because I got some old scripts where I don´t have this setting.they worked
> on MS Win2000 - PWS and PHP 4.0 but now - with Apache 2.2.6, PHP 5.2 on WIN
> XP it doesn´t work.

You might be using the old format of $HTTP_POST_VARS.

Do a search for that string and change it to

$_POST

and the same for $HTTP_GET_VARS (change to $_GET).


It could also be a side-effect of register_globals being enabled in
php4.0 and not in php5.2.

http://www.php.net/manual/en/security.globals.php

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
dmagick [ Do, 10 Januar 2008 03:05 ] [ ID #1904857 ]
PHP » gmane.comp.php.database » forms and method POST - variables

Vorheriges Thema: HAPPY NEW MUSLIM YEAR
Nächstes Thema: Webservices with PHP