创建/编辑php动态页面 [英] Creating/editing a php dynamic page
问题描述
我想要这样做,以便city.php是为这个城市发布不同的东西的中心点。我想要一个页面的事件,新闻,工作和出售。在city.php上,您将为那些页面选择一个链接,这些页面可以让您浏览诸如events.php,news.php,jobs.php和sale.php等页面。我如何保持所有这些页面动态并与所选城市相关?
有很多方法可以在PHP中做这样的事情。我个人不同意你的方法,因为它的声音。我可能错了你似乎在说什么。
正如adam所说,$ _SESSION是第一件事。您还可以查看$ _COOKIE:
http://php.net/manual /en/features.cookies.php
或只是将城市ID作为$ _GET var:
http://www.yoursite.com/events.php?city=2
然后在PHP中阅读,如
$ city_id = $ _GET ['city'];
Ok i have a dynamic page where people can post events in the city, we will call that page: city.php. In order to get to the page though, you must select a state from states.php, then a city from allcities.php. The states and cities are all in mysql database. On the city.php page you can click "add event" and it will take you to createevent.php where you can create and add an event that shows on city.php. But here is what i want to do:
I want to make it so that city.php is the central spot for posting different things for that city. I want a page for events, news, jobs, and for sale. On the city.php you will select a link for those pages taking you to pages such as events.php, news.php, jobs.php, and sale.php. How can i keep all those pages dynamic and related to the selected city? I toyed around and couldn't figure it out.
There are a number of ways to do something like this in PHP. I personally disagree with your method as it sounds. I could be wrong about what it seems like you're saying though.
As adam said, $_SESSION is the first thing in mind. You can also look into $_COOKIE: http://php.net/manual/en/features.cookies.php
or just pass the city id as a $_GET var: http://www.yoursite.com/events.php?city=2
Then read it in PHP like
$city_id = $_GET['city'];
这篇关于创建/编辑php动态页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!