PHP和HTML值提交 [英] PHP and HTML Value submission

查看:59
本文介绍了PHP和HTML值提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!
我是PHP的新手,我对此语言只有非常非常的基础的知识.我想问一个我认为是高级或专家级别的问题.
我的问题是,我想制作一个php页面,其中有一些新闻框,这些新闻框是从数据库中的某些信息中提取的.我已经成功地编写了这些框的脚本.但是最主要的是他们的链接,即他们将在其中重定向用户的链接.当用户单击该框时,我希望他被带到一个可以阅读完整新闻故事的页面.但我希望它只是一个可以显示所有新闻故事的PHP页面.用技术术语来说,当查看者单击该框时,该框会将新闻ID提交到用户将被带到的PHP页面.然后,该PHP页面提取这些名称的文本文件并显示它们.但是主要的问题只是PHP页面提交和识别ID.我可以做剩下的工作.
我认为新闻框将具有唯一的ID,该ID会传递到页面(例如"/news.php?id=50"),但是这里是问题:
1.我不知道onclick会将其ID发送到页面的HTML链接代码(我知道表单,并且我已经使用过表单,但是不知道在表单上单击一下即可将内容提交到页面链接)
2.我不知道该页面将用来标识新闻或ID的PHP代码,该新闻或ID已提交到其URL.

有什么想法吗?

谢谢

Hello!
I am new to PHP and I have just a very, very basic knowledge of this language. I want to ask a question of Advanced or Exert Level I think.
My question is that I want to make a php page, in which there are a few news boxes, which are extracted from some information from a database. I have successfully scripted those boxes. But the main thing is their link, that where they will redirect the user. When the user clicks on the box, i want him to be taken to a page where he can read the full news story. But I want it to be just one PHP page that will show al the news stories. In technical words, when the viewer clicks on the box, the box submits the news id to the PHP page where the user will be taken to. Then that PHP page extracts text files of those names and presents them. But the main problem is only the id submission and recognition by the PHP page. I can do the rest of work.
I have the idea that the news boxes will have a unique id which it will pass to the page (like "/news.php?id=50"), but here''s what ''s the issue:
1. I don''t know the HTML link code which will onclick send this id to the page (I know about forms and I have worked with them but don''t know to submit something to a page on a single click on a link)
2.I don''t know the PHP code which the page will use to identify a news or its id which was submitted to its URL.

Any ideas?

Thanks

推荐答案

获取PHP手册并查找


_GET.它是一个数组,在后面得到东西?在网址中.因此,如果我有< a href ="path/to/news.php?art = 20& size = 10& who = xyz">单击此处</a>的链接,则在单击该链接时,news.php是在服务器上调用,使用
_GET. It is an array that gets the stuff after ? in the URL. So if I have a link <a href="path/to/news.php?art=20&size=10&who=xyz">click here</a>, when it is clicked, news.php is called on the server, with


_GET像这样:
art => 20
大小=> 10
谁=> xyz

news.php可以使用这些来确定要提供的服务.

很简单,不是吗? (实际上,情况要复杂一些,但这会让您入门.)

彼得

如果您喜欢答案,请对其投票,并在回答了问题后将其标记为接受.
_GET like this:
art => 20
size => 10
who => xyz

news.php can use these to determine what to serve.

Pretty simple, isn''t it? (Actually, things are a bit more complicated, but this will get you started.)

Peter

If you like the answer, vote for it, and mark it accepted if it answers your question.


这篇关于PHP和HTML值提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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