简单更改后jrequest不起作用
我正在编辑一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来好像还有其他事情发生,因为新的输入字段似乎是正确的。
我建议使用 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.