简体   繁体   中英

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.

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

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. 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']

Now that I look at it again an easy solution would be if $client= $data['suiting_ref'] or however one should compose it. *

How do you get the id of the client? 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.

try this

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

or

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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