为什么输出是0??(Joomla中的PHP)


Why is the output is 0?? (PHP in Joomla)

我们在Joomla中使用PHP时遇到了这个问题。我们希望输出为 3。

在 HTML 中,我们声明:

var address;
address = '3';

并将以下代码放入以下表单中:

<td><input type="text" id ="amount1.2" name="amount" value="<?php $address = JRequest::getVar('address');?>"/>

在进程/服务器页面中,我们放置以下代码:

$address = JRequest::getVar('address', 'default value goes here', 'post','variable type');

但输出为 0。

首先,你的起始代码块是javascript,而不是HTML。

其次,在其他代码示例中,您只为 PHP 变量$address分配一些值。如果你想让它出现在 HTML 中,你需要printecho变量:

<td><input type="text" id ="amount1.2" name="amount" value="<?php echo JRequest::getVar('address'); ?>"/>