我努力完成我的項目的最後一塊 - 我有一個是通過在格式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 –