Member Avatar for JazzibAli

This is a part of addtobasket.php file
i want to change the normal submit button with my stylish one but dont know how to do.
here is code...

...require("header.php");

    echo "<form action='addtobasket.php?id=". $_GET['id'] . "' method='POST'>";

    echo "<table cellpadding='10'>";

    echo "<tr>";

    if(empty($prodrow['image'])) {

    echo "<td><imgsrc='./images/image_not_found.png' width='50' alt='". $prodrow['name'] . "'></td>";

    }

    else {

    echo "<td>

    <img src='./images/" . $prodrow['image']. "' width='50' alt='" . $prodrow['name']. "'></td>";

    }

    echo "<td>" . $prodrow['name'] . "</td>";

    echo "<td>Select Quantity <select name='amountBox'>";

    for($i=1;$i<=100;$i++)

    {

    echo "<option>" . $i . "</option>";

    }

    echo "</select></td>";

    echo "<td><strong>Rs:". sprintf('%.2f', $prodrow['price']) . "</strong></td>";

    echo "<td><input type='submit'

    name='submit' value='Add to basket'></td>";

    echo "</tr>";

    echo "</table>";

    echo "</form>";

    }

    }
    ?> 

i want to add this button instead of simple submit button

<button class="button green">
    <div class="title">Add to cart</div>
    <div class="price"<?php echo "<td>" . $prodrow['price'] . "</td>"; ?> </div>
    </div>

thanks in advance

I must say I find it prettier if HTML uses the double quotes instead of PHP. E.g. echo '<a href="link">'; instead of echo "<a href='link'>";. But I don't think that's a must.

Your line 11 contains a small error: <imgsrc=.... I would place a space in between the "img" and "src" parts ;).

For the rest, I think that a <button> element in a form acts as a submit button if it's the only button in it. I'm not sure though. I think you could add this line of code to your button: onclick="this.parentNode.submit()" or something like that (not sure if this will work, but hopefully you get the point: use Javascript :)).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.