dswsl2016 2010-07-16 12:58
浏览 52
已采纳

PHP生成并命名日历到mysql数据库的html

I have a PHP page where a user can select a month and then an html label and selection box will generate for each day of the month:

<?php $i=1; while($i <= $daysInMonth){?>
    <table align="center" style="width: 435px">
        <tr>
            <td class="style1"><p><label id="Label1"><?php echo($month.' '.$i); ?></label>&nbsp;</p></td>
            <td class="style1"><p><?php echo($dropdown); ?></p></td>
        </tr>
    </table>
<?php $i++; }?>

The selection boxes are filled with multiple names. The user will then select one or more names for each day of the month. I'm trying to figure out the best solution to match these names to the day of the month and get them into a MySQL database. I don't want to just have 31 $_POST['6'] submissions. I'm trying to think of a way to use arrays, but I'm struggling with determining how to keep names matched with the day of the month.

Should I use a multidimensional array? Any input would be appreciated.

Thanks!

  • 写回答

1条回答 默认 最新

  • dos71253 2010-07-16 14:18
    关注

    Map every day of the month to an unique field name. For instance, if you don't care about years, then you can map day 28 of month 11 to the unique field name "11-28", and look for the data in $_POST["11-28"].

    You can then write a loop that goes through all months and all days, and looks inside $_POST for the data you need.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型
  • ¥15 求学软件的前人们指明方向🥺
  • ¥50 如何增强飞上天的树莓派的热点信号强度,以使得笔记本可以在地面实现远程桌面连接
  • ¥20 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn