简体   繁体   English

如何在PHP标头中定义变量(位置:)

[英]How can I define a variable in the PHP header ('Location:)

I'm trying to redirect to another page when a record is added to the database. 当记录添加到数据库时,我试图重定向到另一个页面。

I want to make sure that this instruction creates an address which contains the id number. 我要确保此指令创建的地址包含ID号。

header('Location:inventory_issue_view.php?filterer_client_name=<%%URLVALUE(suiting_reference_no)%%>');

However the address I get from this is 但是我从这里得到的地址是

inventory_issue_view.php?filterer_client_name=<%%URLVALUE(suiting_reference_no)%%>

I know the value of 我知道的价值

<%%URLVALUE(suiting_reference_no)%%>

is correct since if I edit the instruction to this: 是正确的,因为如果我对此进行编辑说明:

header('Location:inventory_issue_view.php?filterer_client_name=7499');

I get the correct address. 我得到正确的地址。

Using this code: 使用此代码:

 $client=sqlValue("SELECT suiting_reference_no FROM client_suiting WHERE client_name =     '{$data['client_name']}'");

I get a null value for $client 我获得了$ client的空值

Using this code: 使用此代码:

$client=sprintf("SELECT suiting_reference_no FROM client_suiting WHERE client_name = '{$data['client_name']}'");

    $client=SELECT%20suiting_reference_no%20FROM%20client_suiting%20WHERE%20client_name%20=%20%277489%27

This part of a hook after insert in an APPGini generated script. 插入APPGini生成的脚本后,这部分挂钩。 An associative array where the keys are field names and the values are the field data values that were inserted into the new record. 一个关联数组,其中键是字段名称,值是插入到新记录中的字段数据值。
* For this table, the array items are: *对于此表,数组项为:
* $data['issue_date'], $data['client_name'], $data['suiting_ref'], $data['inventory_item'], $data['inventory_qty'], $data['inventory_item_size'], $data['inventory_size_category'], $data['inventory_cost'], $data['inventory_value'] * $data['issue_date'], $data['client_name'], $data['suiting_ref'], $data['inventory_item'], $data['inventory_qty'], $data['inventory_item_size'], $data['inventory_size_category'], $data['inventory_cost'], $data['inventory_value']

Now that I look at it again an easy solution would be if $client= $data['suiting_ref'] or however one should compose it. 现在,我再次看一下它,一个简单的解决方案是$ client = $ data ['suiting_ref']还是应该由它组成。 * *

How do you get the id of the client? 您如何获取客户端的ID? From a query or a form? 从查询还是表格? Hovewer, try: 尝试,尝试:

header("Location:inventory_issue_view.php?filterer_client_name=$clientId");

where $clientId is a variable containing the number. 其中$clientId是包含数字的变量。

try this 尝试这个

header("Location:inventory_issue_view.php?filterer_client_name=".$clientId.");

or 要么

header("Location:inventory_issue_view.php?filterer_client_name=$clientId"); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM