创建/编辑php动态页面 [英] Creating/editing a php dynamic page

查看:152
本文介绍了创建/编辑php动态页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我有一个动态页面,人们可以在城市发布活动,我们会调用该页面:city.php。为了进入页面,您必须从states.php中选择一个状态,然后从allcities.php中选择一个城市。状态和城市都在mysql数据库中。在city.php页面上,您可以单击添加事件,它将带您到createevent.php,您可以在其中创建并添加在city.php上显示的事件。但是这里是我想要做的:



我想要这样做,以便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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆