hey i need some helpn with some conversion

the link currently links the item id to the shopping basket

i currently have a submit button on my site which looks like this

<!--<input type="button" value="Add to Cart" onclick="addtocart(<?=$row['itemid']?>)" />-->

and is linked to this script

<!--<script language="javascript">
    function addtocart(pid){
        document.form1.productid.value=pid;
        document.form1.command.value='add';
        document.form1.submit();
    }
</script>-->

but i would preferably use html/php (see below) and use this instead but i do not know how to properly implement it:

<!--<a href="basket.php?action=add&id=<?php echo $row["itemid"];?>">Add Item</a>-->

any help towards the right direction will be greaty appreciated

Regards

Foad Izagaren

How do I put this.

When your user clicks on the SUBMIT button, well, PHP has bin and gone and has nothing to do with the page any more.

PHP runs on the SERVER.

Javascript runs on the CLIENT in the clients BROWSER.

Now that should be hint enough for you to workout how to complete your submit function.

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.