Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Feb 2003
    Location
    London, UK
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Displaying differing variables using a set table layout

    Hey people,
    OK, what I need to do is have a page of the products with each product in a table layout. The table layout is shown in $layout.
    How can I make it so that in $layout the values of $product is product[1], then product[2], and if I added a product[3] it will be displayed in another table?


    <?php

    $product[1]="Osiris";
    $price[1]="£60";
    $description[1]="An awesome shoe.";
    $image[1]="osiris.jpg";

    $product[2]="Osiris 2";
    $price[2]="£61";
    $description[2]="An awesome shoe 2.";
    $image[2]="osiris2.jpg";



    $layout="<table cellspacing=0 cellpadding=0 border=0><tr><td rowspan=3><img src=".$image." width=150 height=100></td><td><b>".$product." </b></td></tr><tr><td>".$description."</td></tr><tr><td>".$price."</td></tr></table><p>";


    ?>

    - I know this code isn't correct and won't work, but I thought I'd post it so its easier to see what I mean.

    Thanks for any help

    Jay Vincent
    Last edited by Jay Vincent; 01-23-2004 at 08:06 PM.

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    paris, france
    Posts
    1,216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    have you tried a "for" loop? i don't really understand yor question.
    photoshop too expensive? use the GIMP! www.gimp.org

  • #3
    New Coder
    Join Date
    Feb 2003
    Location
    London, UK
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah I can't explain it very well, lol sorry. I'll try again

    What I want is a page of products, where each product is displayed in a table, and each product is one above the other.

    http://www.jaydesigns.co.uk/soulcarv...ng/testing.php

    this shows the layout with just one product. The coding for that was:

    $product1="Osiris";
    $price1="£60";
    $description1="An awesome shoe.";
    $image1="osiris.jpg";

    $layout="<table cellspacing=0 cellpadding=0 border=0><tr><td rowspan=3><img src=".$image1." width=150 height=100></td><td><b>".$product1." </b></td></tr><tr><td>".$description1."</td></tr><tr><td>".$price1."</td></tr></table><p>";

    echo($layout);


    Do you see that if I then add $product2, $price2, $description2 and $image2 I would need to add another $layout with all the variables changed.
    I was asking if there was a solution so I don't have to add more $layout's for every new product.

    Hope that makes more sense!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •