在php中制作表格菜单
好吧,我想做的是一个支持票证的系统。票证包含有关特定工作的各种信息。我怎样才能制作一个带有类似门票链接的门票菜单,其中包含我需要的所有信息。例如,我单击票号 777,因此网址中包含 php?id=777。
我需要这个页面来不断寻找新的门票。
Ok what I am trying to make is a system that supports tickets. Tickets have all kinds of info on a specific job. How can I make a ticket menu with like links to tickets which contain all the info I need. For instance I click on ticket number 777 so it I have the php?id=777 in the url.
I need this page to constantly look for new tickets.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要做的是将正确的票添加到
page.php 上的锚点,您可以使用
$_GET
变量访问票号what you need to do is add a the correct ticket to an anchor
on the page.php you can access the ticket number using the
$_GET
variable我需要此页面不断寻找新门票。
我不能 100% 确定您在这里到底要寻找什么,但这里有两个基本解决方案:
第一个对于不断更新的内容更好,例如 Twitter 帖子、新闻、股票行情等,但对于更新相对很少的内容(需要比6分钟或 所以)。
票证应该存储在某种数据库中,然后读出并循环以创建表。这可能在列表格式(堆叠的 div)而不是表格中更有意义,但话又说回来,我不知道具体细节。
对于简单的 PHP 链接生成,@Ibu 有一个很好的例子。
编辑:
有关实现 AJAX 的更多信息,此页面有一个很好的示例。我建议使用像 jQuery 或 MooTools 这样的框架来处理 AJAX,因为浏览器之间存在一些不一致。
编辑:
从您的评论来看,您似乎不太熟悉 PHP 的工作原理。
PHP 只是一种具有一些编程语言特性的模板语言。它最适合使用数据库中的动态内容动态生成页面。
当您尝试请求
.php
页面时,您实际上是在告诉服务器执行该文件中的代码。当所有代码完成后,生成的文档将提供给请求的浏览器。如果操作正确,结果应该是有效的 HTML。I need this page to constantly look for new tickets.
I'm not 100% sure what you're exactly looking for here, but there are two basic solutions here:
The first is better for things that are constantly updated, like Twitter posts, news, stock-tickers, etc, but it's a little overkill for something that updates relatively rarely (takes longer than 6 minutes or so).
The tickets should be stored in some kind of database and then read out and looped over to create the table. This would probably make more sense in a list format (stacked divs) instead of a table, but then again, I don't know the specifics.
For the simple PHP generation of links, @Ibu has a good example.
EDIT:
For more information about implementing AJAX, this page has a good example. I would recommend using a framework like jQuery or MooTools to handle the AJAX because there are some inconsistencies between browsers.
EDIT:
From the comments you made, it sounds like you are not very familiar with how PHP works.
PHP is just a templating language with some programming language features. It is best used to generate pages on the fly with dynamic content from a database.
When you try to request a
.php
page, you are actually telling the server to execute the code in that file. When all the code is finished, the resulting document is given to the requesting browser. The result should be valid HTML if done correctly.