开发者

How do $_REQUEST two fields and post them together on another page?

开发者 https://www.devze.com 2023-04-07 19:26 出处:网络
I have a form that inserts data into mySQL.It works fine. After the submission, I have a success page that displays \'part_no\'.I need to also开发者_JS百科 show \'add_qty\', as well.

I have a form that inserts data into mySQL. It works fine.

After the submission, I have a success page that displays 'part_no'. I need to also开发者_JS百科 show 'add_qty', as well.

How do i alter my post script to show two field data's on the success page?

Here is part of my code (that already works):

$part_no = $_REQUEST['part_no'] ;

header("location: inv_fc_add_success.php?part_no=" . urlencode($part_no));
}
else {
header("location: inv_fc_add_fail.php");
}
?>


Just append it as another $_GET variable i.e part_no="part"&quantity=1

header("location: inv_fc_add_success.php?part_no=" . urlencode($part_no)."&qty=".$quantity );


You need 3 things.

First, you'll need:

$add_qty = $_REQUEST['add_qty'];

Alternatively you can simply use $_REQUEST['add_qty'] directly instead of assigning it to a new variable ($add_qty).

Then instead of:

header("location: inv_fc_add_success.php?part_no=" . urlencode($part_no));

you need:

header("location: inv_fc_add_success.php?part_no=" . urlencode($part_no) . "&add_qty=" . urlencode($add_qty));

Then, on the page inv_fc_add_success.php (which you will need to edit), you display the variable the same way that you display $part_no. As always, you can either assign it to a variable, like you already do at the top, or you can just use $_REQUEST['add_qty'] directory.

0

精彩评论

暂无评论...
验证码 换一张
取 消