Я обрушиваю голову на стену ... Я делаю простой модуль joomla, в helper.php Я не могу присвоить значения, отправленные из формы.Переменная в модуле Joomla
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
class modReservationHelper {
public $name;
public $email;
public $message;
public $comment;
protected function __construct() {
$this->name = $_POST['fullname'];
$this->email = $_POST['email'];
$this->message = $_POST['message'];
$this->comment = $_POST['comment'];
}
function validateForm() {
echo $this->name; //The output is always 0
echo $this->email+"</br>";//The output is always 0
echo $this->message;//The output is always 0
//When I try
echo $_POST['comment']; // Is correct
}
}
?>
Также я старался не использовать конструктор с тем же нулевым эффектом :(
<?php
// no direct access
defined('_JEXEC') or die('Restricted access');
class modReservationHelper {
public $name;
public $email;
public $message;
public $comment;
function getValues() {
$this->name = $_POST['fullname'];
$this->email = $_POST['email'];
$this->message = $_POST['message'];
$this->comment = $_POST['comment'];
}
function validateForm() {
modReservationHelper::getValues;
echo $this->name; //The output is always 0
echo $this->email+"</br>";//The output is always 0
echo $this->message;//The output is always 0
//When I try
echo $_POST['comment']; // Is correct
}
}
?>
Вся процедура вызывается из "mod_wreservation.php" Я называю modReservationHelper :: validateForm();
Как вы вызывающая функция класса modReservationHelper? – Gaurav
См. Выше edit. – Jim