在PHP中传递参数 [英] Passing a parameter in PHP

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

问题描述



大家好,


我正在严格用PHP编写一些屏幕。我有一个带有

组合框的屏幕。我不想使用表单,只需要页面上的链接。


我想做的是,当用户从组合中选择值时

框,并点击链接,我希望组合框中的值是作为参数传递到另一个PHP页面,并在该页面中使用。


我真的想避免表格和整个GET / POST的东西。


有没有办法做到这一点?可能是Javascript?我很糟糕

Javascript,所以如果这样,如果你可以包括和示例,

我会非常感激。


谢谢!

解决方案

am am **** @ iwc.net 写道:


大家好,


我我正在用PHP严格写一些屏幕。我有一个带有

组合框的屏幕。我不想使用表单,只需要页面上的链接。


我想做的是,当用户从组合中选择值时

框,并点击链接,我希望组合框中的值为

作为参数传递到另一个PHP页面,并在该页面中使用。



好​​吧,如果框中的

值发生变化,你应该在你的页面中重写所有< a href =""

将组合框选择添加到当前URL。

但你说你吮吸javascript,所以这可能是你的头脑。

(继续阅读)


我真的想避免表格和整个GET / POST的东西。


有没有办法做到这一点?可能是Javascript?我很糟糕

Javascript,所以如果这样,如果你可以包括和示例,

我会非常感激。



也许你可以在改变组合框时设置一个cookie,它保存选择元素的

值。

您不必刷新页面或任何内容,只需设置一个cookie。


每次请求都会向PHP发送Cookie。

例如:


<?php

//收到组合框的cookie?

if(isset(


_COOKIE [" mycombobox"])){

//使用

中的值

_COOKIE [" mycombobox"]

}

?>


也许有帮助。


就个人而言,如果我看到的话一个没有

提交按钮的组合框(或任何元素),我会感到困惑。

你确定要这个吗?


问候,

Erwin Moller


>

谢谢!



Hi All,

I am writing some screen strictly in PHP. I have a screen with a
combo box in it. I do not want to use forms, just links on the page.

What I want to do, is when the user selects the value from the combo
box, and clicks on the link, I want the value in the combo box to be
passed as a parameter to another PHP page, and be used in that page.

I really want to avoid forms and the whole GET/POST stuff.

Is there any way to do this? Javascript maybe? I''m terrible at
Javascript, so if this is the way, if you could include and example,
I''d greatly appreciate it.

Thanks!

解决方案

am****@iwc.net wrote:

Hi All,

I am writing some screen strictly in PHP. I have a screen with a
combo box in it. I do not want to use forms, just links on the page.

What I want to do, is when the user selects the value from the combo
box, and clicks on the link, I want the value in the combo box to be
passed as a parameter to another PHP page, and be used in that page.

Well, you should rewrite all <a href=""in your page on the fly if the
value in the box is changed.
Add the comboboxselection to the current URL.
But you said you suck at javascript, so this maight be over your head.
(read on)

I really want to avoid forms and the whole GET/POST stuff.

Is there any way to do this? Javascript maybe? I''m terrible at
Javascript, so if this is the way, if you could include and example,
I''d greatly appreciate it.

Maybe you could set a cookie when the combobox is changed that holds the
value of the element choosen.
You do not have to refresh the page or anything, just set a cookie.

Cookies are send to PHP on each request.
eg:

<?php
// cookie received for combobox?
if (isset(


_COOKIE["mycombobox"])){
// do stuff with the value in


_COOKIE["mycombobox"]
}
?>

Maybe that helps.

Personally, if I see a combobox (or any formelement) without a
submitbutton, I will be confused.
Are you sure you want this?

Regards,
Erwin Moller

>
Thanks!


这篇关于在PHP中传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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