开发者

Making a menu of tables in php

开发者 https://www.devze.com 2023-03-19 19:34 出处:网络
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 ne

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开发者_如何学C for new tickets.


what you need to do is add a the correct ticket to an anchor

<a href="page.php?id=777">Ticket 777</a>
<a href="page.php?id=778">Ticket 778</a>

on the page.php you can access the ticket number using the $_GET variable

<?php
   $ticket = $_GET['id'];
   /// now you have the ticket number in the variable
?>


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:

  • AJAX to update the content without reloading the page
  • Reload the page every few minutes and have PHP handle it

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消