Jump to content

pwesthead

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by pwesthead

  1. hi i have a shopping cart where i get the products from mysq,l the problem is whatever item i add to my cart it only add the last entry from the database here is my code <form method="post" action="" class="jcart"> <fieldset> <input type="hidden" name="my-item-id" value="<?php echo $all['id'];?>" /> <input type="hidden" name="my-item-name" value="<?php echo $all['title'];?>" /> <input type="hidden" name="my-item-price" value="<?php echo $all['sale_price'];?>" /> <input type="hidden" name="my-item-qty" value="1" size="3" /> <!--product item--> <?php //retrive categories from the categories table $allitems=mysql_query("SELECT * FROM dg_products ") or die("There are no records to display ... \n" . mysql_error()); ?> <?php while ($all=mysql_fetch_array($allitems)) { ?> <div class="product_item"> <figure class="r_corners photoframe shadow relative hit animate_ftb long"> <!--product preview--> <a href="#" class="d_block relative pp_wrap"> <!--hot product--> <span class="hot_stripe"><img src="images/hot_product.png" alt=""></span> <img src="/keiths/<?php echo $all['image'];?>" class="tr_all_hover" alt=""> <span data-popup="#<?php echo $all['id']?>" class="button_type_5 box_s_none color_light r_corners tr_all_hover d_xs_none">Quick View</span> </a> <!--description and price of product--> <figcaption> <h5 class="m_bottom_10"><a href="#" class="color_dark"><?php echo $all['title'];?> </a></h5> <div class="clearfix"> <p class="scheme_color f_left f_size_large m_bottom_15"><s>&pound<?php echo $all['price'];?></s> &pound<?php echo $all['sale_price'];?></p> <input type="submit"class="button_type_4 bg_scheme_color r_corners tr_all_hover color_light f_left mw_0" name="my-add-button" value="add to cart" /></form>
  2. Ha Ha so easy when you know how thanks paul
  3. I have a dropdown list in a html form, i get the info for the dropdown list from mysql database using php, the problem is when i choose a name from the drop downlist and echo the name out i only get half the name if there is a gap in the name, eg if i get a name bart simpson it will only output bart and not show the last name, its something to do with the space in the name. here is the code. <form action='<?php echo $_SERVER['PHP_SELF']?>' method=post> <select name='charity_name' id="charity_name"> <option <?php //loop through categories table rows while ($row=mysql_fetch_array($charity)){ echo "<option value=$row[charity_name]>$row[charity_name]"; } ?></option> </select> <input type=submit value="Go"> </form> <? $charity_name=$_POST['charity_name']; ?> <?php echo $charity_name;?> thanks paul
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.