Hi there,
Im not exactly great at php but im learning steadily.

My latest venture is an online catalogue with an ordering system.

Basically I need to know how to store the products they 'order' and the best way to do this. After ALOT of research I am still at a dead end with it.
I have gathered you use session arrays like:

session_register('incart'[]);

where incart is a variable passed by the buy link.

Is this correct??
And how do i keep adding to this array??


Also (Sorry about this)

When I add a product to a database with the name e.g 'Makeup is here'
When I try to dynamically link from that only the first word is used 😕
For example, lets say i have the variable $make , which relates to the test in the database in the columb 'make'. I then make a link like so:

<a href="<?php echo("$PHPSELF?make=$make"); ?>">Name</a>

the link that actually is displayed will only be the irst word in the databsaea cell.

index.php?make=makeup

INSTEAD OF

index.php?make=Makeup is here

What can I do to remedy this??

    I'll just help with the top question for now.

    Hi there,
    Im not exactly great at php but im learning steadily.

    My latest venture is an online catalogue with an ordering system.

    Basically I need to know how to store the products they 'order' and the best way to do this. After ALOT of research I am still at a dead end with it.
    I have gathered you use session arrays like:

    session_register('incart'[]);

    where incart is a variable passed by the buy link.

    Is this correct??
    And how do i keep adding to this array??

    I think that something like this is what you would want to use:

    <?
    session_start();

    $SESSION[ring][0] = "ring ";
    $
    SESSION[ring][1] = "ring ";
    $_SESSION[ring][2] = "ring ";

    echo $SESSION[ring][0];
    echo $
    SESSION[ring][1];
    echo $_SESSION[ring][2];

    ?>

    as an example of how to use a $_SESSION array. Hope that helps.

      Thankyou for your reply. This has helped my understanding but how do i dynamically (through a link) add to this array??

        Originally posted by XpeteX
        Is this correct??
        And how do i keep adding to this array??

        yes, this is correct. you might want to register another session array called "$quatity" so they can order more than 1.

        if you want to add to the array, just do this:

        $incart[]="new_item_id";

        if you put the brackets after the variable, it will just add your new item id on top of the existing array.

        Originally posted by XpeteX How do i make my shown results from a db have 2 filtering terms??

        I guessed it would be:

        $SQL = "SELECT * FROM products WHERE prodgenre LIKE '$content' AND make LIKE '$make'";

        but this didnt work for me .😕 [/B]

        i am confused too =) your first question was more direct. the query looks fine to me but then again, i don't know exactly what you are sending to it.. nor do i know your database.

        good luck,

          Thankyou very much, this has helped greatly....

          could you just put an example of a link for me? Im not sure how to integrate it.

          my links usualy go something like...

          <a href="<?php echo("$PHP_SELF?$address&......

          where $address is a variable i set that holds the page properties (e.g is the content is news etc)

            For your second problem, you must use the rawurlencore() function for the variables you want to put in url. Because the space and some other char may cause problem.
            try :
            <a href = "<?php echo("$PHPSELF?make=".rawurlencode($make)); ?>">Name</a>

              I cant seem to get this working.

              Could i say something like this:

              $prodmake=".rawurlencode($prodmake)";

              in the displaying results loop of the make names, then it would change with tvery loop around right??

                I don't understand (my english is poor) what you mean by "loop" in this case, but the rawurlencode() function encode some character, like spaces, which could not be use into url. In this case, the result of
                rawurlencode("Makeup is here") will be "Makeup%20is%20here"
                But you will get "Makeup is here" in your var on the target page.

                  Thankyou for your respoce. This is very nice of you to put time out just for me.

                  Although more information would be nice, thankyou.

                  Again, thankyou.

                    Write a Reply...