第一頁上有一個帶有 jquery 腳本的表單,用于添加天數。如果我只使用一天,我無法獲得我需要的所有信息。但是當我添加多天時,我只得到最后一個條目。我試圖查看我在下一頁 book_gear.php 的表格中預訂的活動的每一天。但到目前為止我只看到了這一活動的一天。我認為這是因為我的 foreach 循環考慮的是數組索引而不是數組中的每個事件。book_avail.php<?php require_once('../Include/initialize.php'); ?><!doctype html><html> <!--Sets page title in browser--><?php $page_title = 'Schedule'; ?> <!-- Imports header file with necessary scripts --><?php include ('../Include/header.php'); ?><!-- Imports Top navigation bar --><?php include ('../Include/navibar.php'); ?><!-- Imports javascript file to allow arrange by column --><?php include_once ('../Include/sort_by.php'); ?><?php include_once ('../Include/mysql_queries.php');//loads all classesinclude_once ('../Include/class-autoload.inc.php'); ?><script> $(document).ready(function() { var i = 1; $("#add_row").click(function() { $('tr').find('input').prop('disabled',true) $('#addr' + i).html("<td>" + (i + 1) + "</td><td><input type='text' value='Day" + (i + 1) +"' name='event[" + i + "][eventNameInitialQuery]' class='form-control input-md'/></td>\n\ <td><input type='date' name='event[" + i + "][dateFromIntialQuery]' placeholder='date' class='form-control' /></td>\n\ <td><input type='time' name='event[" + i + "][timeFromIntialQuery]' placeholder='time' class='form-control' /></td>\n\ <td><input type='date' name='event[" + i + "][dateToIntialQuery]' placeholder='date' class='form-control' />\n\</td>\n\ <td><input type='time' name='event[" + i + "][timeToIntialQuery]' placeholder='time' class='form-control' />\n\</td>"); $('#tab_logic').append('<tr id="addr' + (i + 1) + '"></tr>'); i++; });});</script><script src="https://code.jquery.com/jquery-3.2.1.js"></script><?php//sets user location or builingif (isset($_SESSION['location'])) {$userLocation = $_SESSION['location']?? '';}$build_set = build_dropdown($userLocation);?>
- 1 回答
- 0 關注
- 89 瀏覽
添加回答
舉報
0/150
提交
取消