Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Posts
    354
    Plugin Contributions
    0

    Default two submit buttons

    I am trying to create a buy now feature so I have created another button on the product_info page. So now there are two submit buttons - the normal 'add to cart' button and my 'buy now' button.

    After some testing however I am having difficulty in getting the next page to differentiate between the two buttons (which one was pressed). I have used techniques such as this:

    in tpl_prod_info.php:

    Code:
    <form name="testform" method="post" action="index.php?main_page=shopping_cart">
    <input type="submit" name="button1" value="life">
    <input type="submit" name="button2" value="Death"> 
    </form>
    in tpl_shopping_cart_default.php:

    PHP Code:
    if ($_POST['button1']) {

    echo 
    "button 1 was pressed";

    }

    if (
    $_POST['button2']) {

    echo 
    "button 2 was pressed";


    .. which as a test works perfectly fine but when I apply it to the 'add to cart' and new 'buy now' buttons it doesn't. Here's what I tried amongst other things:

    in tpl_prod_info.php - the 'add to cart' button is already set and these are its properties:

    PHP Code:
    $the_button '<input type="hidden" name="cart_quantity" value="1" />' zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CARTBUTTON_IN_CART_ALT);
     
    $display_button zen_get_buy_now_button($_GET['products_id'], $the_button); 
    in tpl_prod_info.php - here is the 'buy now' button:

    PHP Code:
    $the_button2 '<input type="hidden" name="cart_quantity2" value="1" />' zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_BUY_NOWBUTTON_IN_CART_ALT);

    $display_button2 zen_get_buy_now_button($_GET['products_id'], $the_button2); 
    in tpl_shopping_cart_default.php:

    PHP Code:
    if ($_POST['cart_quantity']) {

    echo 
    "cart_quantity was pressed";

    }

    if (
    $_POST['cart_quantity2']) {

    echo 
    "cart_quantity 2 was pressed";


    I know that the buttons in the first example are significantly different - but does anyone know how I can do this or what I might be doing wrong??

    _thanks to all

  2. #2
    Join Date
    Feb 2009
    Posts
    354
    Plugin Contributions
    0

    Default Re: two submit buttons

    anyone at all?? .. jab..

  3. #3
    Join Date
    Feb 2009
    Posts
    354
    Plugin Contributions
    0

    Default Re: two submit buttons

    So no-one knows anything about this subject??

 

 

Similar Threads

  1. v139h CSS buttons submit problem
    By unlucky-pete in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 16 Feb 2013, 02:27 PM
  2. rollover submit buttons
    By airscopes in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 22 Feb 2011, 10:59 PM
  3. Using html submit buttons instead of image buttons
    By Ralf Skirr in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 7 Nov 2009, 12:10 PM
  4. link buttons vs. submit buttons
    By clevername in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 28 Jun 2008, 03:07 PM
  5. Autogenerating Submit Buttons
    By lightgate in forum General Questions
    Replies: 1
    Last Post: 5 May 2008, 03:03 PM

Posting Permissions

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