J'ai commencé à faire une classe pour ça:
Code :
<?php
/*---------------------------------------------------------------------------//
* Program: Request Class //
* Programmer(s): René Rhéaume <rener@mediom.qc.ca> //
* Creation Date: 2002/05/17 //
* Last Modification: 2002/05/17 //
* Object: Class emulating parts of the ASP Request object //
* Modifications : ------------------------ Date ------------------------- //
* Source file request.php //
//---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------//
* This program is free software; you can redistribute it and/or modify it //
* under the terms of the GNU General Public License as published by the Free //
* Software Foundation; either version 2 of the License, or (at your option) //
* any later version. //
* //
* This program is distributed in the hope that it will be useful, but //
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY //
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License //
* for more details. //
* //
* You should have received a copy of the GNU General Public License along //
* with this program; if not, write to the Free Software Foundation, Inc., //
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
//---------------------------------------------------------------------------*/
class Request
{
var $vntQueryString;
var $vntPostData;
function Request()
{
if (PHP_VERSION >= 4.1)
{
$this->vntPostData = $_POST;
$this->vntQueryString = $_GET;
}
else
{
$this->vntPostData = $HTTP_POST_VARS;
$this->vntQueryString = $HTTP_GET_VARS;
}
}
function QueryString($strFormField)
{
$vntRetVal = null;
if (isset($this->vntQueryString[$strFormField]))
{
$vntRetVal = $this->vntQueryString[$strFormField];
}
return ($vntRetVal);
}
function Form($strFormField)
{
$vntRetVal = null;
if (isset($this->vntPostData[$strFormField]))
{
$vntRetVal = $this->vntPostData[$strFormField];
}
return ($vntRetVal);
}
}
?>
J'ai deux questions:
- Est-ce que les destructeurs existent en PHP ?
- Comment je modifie ma classe pour qu'elle soit capable de gérer autant les contrôles simples et les groupes de contrôle ?