POST help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
C_Calav
Forum Contributor
Posts: 395
Joined: Wed Jun 02, 2004 10:55 pm
Location: New Zealand

POST help

Post by C_Calav »

page 1

Code: Select all

<form name="form1" method="post" 
action="cart.php?action=add_item&id=<?php echo $rowї"itemId"]; ?> &qty=1&url=<?php echo $P_Cat; ?>">
page 2

Code: Select all

<?php
   case "add_item": 
      { 
         AddItem($_GET["id"], $_GET["qty"],  $_GET["url"]); 
         ShowCart($rs_cart); 
         break; 
      } 
?>

Code: Select all

&lt;a href="&lt;?php echo $_POST&#1111;'url'];?&gt;.php"&gt;continue shopping&lt;/a&gt;

but the result i get is http://www.mysite/.php

am i doing something wrong? am i "GETTING" the variable properly from the previous page?

thanx
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Re: POST help

Post by timvw »

C_Calav wrote:page 1

Code: Select all

<form name="form1" method="post" 
action="cart.php?action=add_item&id=<?php echo $row&#1111;"itemId"]; ?> &qty=1&url=<?php echo $P_Cat; ?>">

Code: Select all

<a href="<?php echo $_POST&#1111;'url'];?>.php">continue shopping</a>
but the result i get is http://www.mysite/.php
Well, you are not POSTing url. You are passing it as a GET variable (as it's in the URL you request).

If you add a <input type="hidden" name="url" value="<?= $P_CAT ?>" /> to your input form, it will be available in $_POST.
Post Reply