我努力完成我的项目的最后一块 - 我有一个是通过在格式YYYY日期时间选择器填充的文本/ MM/DD HH:MMPHP进行urlencode jQuery的字符串
我需要将此值传递给URL字符串,然后将其发送到数据库表。
由于I''m使用模式,以收集我需要我有一个jQuery脚本改变提交按钮我HREF标签的附加信息:
$(document).on('click','#myModal<?php echo $v['id']; ?> .modal-footer a', function(e)
{
e.preventDefault();
//function to update HREf attribute with values from modal screen
var uri = <?php urlencode('2016/01/01/ 21:00')?>
//$('#divert_until_<?php echo $v['id']; ?>').text();
window.location.href=window.location.href= $(this).attr('href') + '&to=' + $('#divert_to_<?php echo $v['id']; ?> option:selected').text() + '&type= ' + $('#divert_type_<?php echo $v['id']; ?> option:selected').text() + '&until= ' + uri;
});
目前,我收到的所有信息(ID ,TO和TYPE),但UNTIL没有任何结果。上面我试图将固定字符串'2016/01/01 21:00'保存到数据库。
这里是我的代码来捕获的网址:
if(isset($_GET['action']) && $_GET['action']=='add_divert') {
if(!isset($_GET['id']) || !is_numeric($_GET['id'])) {
$_SESSION['notification'] = array('type'=>'bad','msg'=>$lang['ADMIN_INVALID_ID']);
redirect(ROOT_URL.'stores.php?search='.$_REQUEST['search'].$pg.$st.$fl);
}
$db = db_connect();
if($db->update('stores',array('divert_enabled'=>1,'divert_type'=>($_GET['type']),'divert_until'=>($_GET['until']),'divert_to'=>($_GET['to'])),$_GET['id'])) {
$_SESSION['notification'] = array('type'=>'good','msg'=>'Divert notice added to destination.');
} else {
$_SESSION['notification'] = array('type'=>'bad','msg'=>'Could not add a divert notice to the destination.');
}
redirect(ROOT_URL.'stores.php?search='.$_REQUEST['search'].$pg.$st.$fl);
}
我已经尝试了一些变化,但我只是转圈圈。
最后,我需要从('#divert_until_<?php echo $v['id']; ?>').text()
由于重试的日期时间字符串!
什么你的问题? –
如何将日期时间值从文本框传递给接受查询接受的格式的URL –