第一页上有一个带有 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 关注
- 70 浏览
添加回答
举报
0/150
提交
取消