简单更改后jrequest不起作用

发布于 2024-11-05 16:33:46 字数 1461 浏览 0 评论 0原文

我正在编辑一个 joomla 网站,并且在一个表单中我需要用简单的文本字段交换一些下拉选择框。例如,我交换了这个:

<select name="date" id="date" class="date_tag">
<?php   for($i=1;$i<=31;$i++)   {   ?>

        <option value="<?php echo $i; ?>" <?php if($i == date('d')) echo 'selected="selected"'; ?>><?php echo $i; ?></option>

    <?php   }   ?>
    </select>

与那个:

<input type="text" name="date" id="date" class="date_tag">

在表单的最终处理中,我无法获取从 select 交换的字段的值 框到文本字段。 尽管此表单中还有其他文本字段。我无法说出有什么不同。 处理是使用 JRequest 完成的,如下所示:

if(JRequest::getInt('step', 0) == 2)    {   
global $mainframe;  
$fstate     = JRequest::getVar('fstate', '');
$fzip       = JRequest::getVar('fzip', '');
$tstate     = JRequest::getVar('tstate', '');
$tzip       = JRequest::getVar('tzip', '');
$month      = JRequest::getVar('month', '');
$date       = JRequest::getVar('date', '');
$year       = JRequest::getVar('year', '');
$weight     = JRequest::getVar('weight', '');
$type       = JRequest::getVar('type', '');
$first_name = JRequest::getVar('first_name', '');
$last_name  = JRequest::getVar('last_name', '');
$email      = JRequest::getVar('email', '');
$phone_type = JRequest::getVar('phone_type2', '');
$phone_num  = JRequest::getVar('phone_num', '');
$time       = JRequest::getVar('time2', '');
    ....

即使我在该字段中输入了值,我也得到 $date='' 。 正如我所说,它在我进行交换之前有效。 可能是什么问题? 谢谢。

i'm editing a joomla website and in a form I needed to swap some dropdown select boxes with simple text fields. for example I swapped this:

<select name="date" id="date" class="date_tag">
<?php   for($i=1;$i<=31;$i++)   {   ?>

        <option value="<?php echo $i; ?>" <?php if($i == date('d')) echo 'selected="selected"'; ?>><?php echo $i; ?></option>

    <?php   }   ?>
    </select>

with that:

<input type="text" name="date" id="date" class="date_tag">

in the final proccessing of the form I can't get the values of the fields I swapped from select
boxes to text fields.
although there are other text fields in this form. I can't tell what's different.
the processing is done with JRequest as in here:

if(JRequest::getInt('step', 0) == 2)    {   
global $mainframe;  
$fstate     = JRequest::getVar('fstate', '');
$fzip       = JRequest::getVar('fzip', '');
$tstate     = JRequest::getVar('tstate', '');
$tzip       = JRequest::getVar('tzip', '');
$month      = JRequest::getVar('month', '');
$date       = JRequest::getVar('date', '');
$year       = JRequest::getVar('year', '');
$weight     = JRequest::getVar('weight', '');
$type       = JRequest::getVar('type', '');
$first_name = JRequest::getVar('first_name', '');
$last_name  = JRequest::getVar('last_name', '');
$email      = JRequest::getVar('email', '');
$phone_type = JRequest::getVar('phone_type2', '');
$phone_num  = JRequest::getVar('phone_num', '');
$time       = JRequest::getVar('time2', '');
    ....

i get that $date='' even when I entered a value to that field.
as I said it worked before I made the swap.
what could be the problem?
thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

2024-11-12 16:33:46

听起来好像还有其他事情发生,因为新的输入字段似乎是正确的。

我建议使用 print_r($_POST) 并跟踪数据。

Sounds like there is something else going on here, as the new input field appears to be correct.

I would suggest using print_r($_POST) and tracing through the data.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文