Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    Help, im lost, how do i do this. lol

    i have two pages, basically one is called products.php the other cart.php

    i want to be able to pass a variable from products.php to cart.php well to any other page infact.(not in the url) is that global vars or sessions or something? i dont know, can someone post a sample code or know what i need to do ?

    the objective is to parse a category sitewide, so on any page when the user hits the return to category button the variable set by products.php is the one that they get and then they are returned to the correct page.

    thanks.

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    if you don't want to send it in the url, why not just send it in the http headers via a post? like so:
    PHP Code:
    <form action="cart.php">
        <
    input type="hidden" name="id" value="1">
        <
    button type="submit"><img src="product.gif"></button>
    </
    form
    Then, on the next page
    PHP Code:
    <?php
    echo $_POST["id"];
    ?>

  4. #3
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    will that id be avaliable everywhere once it has been submitted? as in when pages change etc?

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    You might want to look into using sessions (http://www.php.net/session , IIRC). They allow you to maintain a constant state between pages for unique users.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  6. #5
    Senior Member toadeny's Avatar
    Join Date
    May 2003
    Location
    Wellington, New Zealand
    Posts
    188
    Member #
    1426
    Thanks very much, I have solved the issue by setting a session variable, and it works sweetly.
    Cheers.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:55 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com