English 中文(简体)
成功执行任务后上页的间接用户
原标题:redirect user on previous page after successfull task
  • 时间:2011-05-17 11:52:14
  •  标签:
  • php

What should be good way to redirect user after successful action like edit or delete any item, in delete condition we could use $_SERVER[ HTTP_REFERER ] but in case of edit, we show first of all edit form and then user clicks update, so if we use same approach user would be redirected to edit page not main page. I hope you got idea about my confusion. thanks.

问题回答

如果通过一个表格处理更新问题,就只是为了反映着陆场而提供了隐蔽的投入。

<input type="hidden" name="next_url" value="foo.php" />

The PHP uses the value as the place to redirect to.

<?php
  // Do operations.
  header( Location:  .$_REQUEST[ next_url ]);

这一点特别重要,因为没有保证吉大港山区就业。 它大部分时间运作,但有一些问题依靠它。

我建议永远不要使用吉卜赛人。

  1. It is possible it isn t set at all.
  2. It can be anything, don t expect your previous page.

我建议采用(如上所述)隐蔽的田地、会议储存或简单地在你的申请中具有坚实的路线,从而找到一个可靠的解决办法,使你知道有人走过哪条路。 最好。

如果你用<代码>将科索沃改为: SERVER[ HTTP_REFER], 您可以简单地将这一价值储存在届会信息中,并在编辑完成时转至它。

例如,在展示贵重表格之前,你可以做到:

$_SESSION[ originalReferer ] = $_SERVER[ HTTP_REFERER ];

在点击“最新”之后(如果成功的话):

header("Location: ".$_SESSION[ originalReferer ]);

但是,只有你相信<代码>_美元,才能使用。 SERVER[HTTP_REFER]!

同先前的答复一样,我建议保持你希望改用会议的网页的轨道,然后,一旦你想要改用,就应该正确使用。

header( Location:  .$redirect_var);

我将把它放在本届会议上,而不是放在形式上,其原因是,表格张贴可由用户操纵,而会议是服务器,完全由你自己控制。

页: 1

header( Location:  .$_SESSION[ redirect_url ]);




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签