Jump to content

html button to pass variable content


lassoloc

Recommended Posts

Hello World,

 

I need some tips on how to make a button that does something like the code below.

 

.......echo '<tr><td align="left"><a href="add_cart.php?pid=' . $row1['item_id'] . '">Add to Cart</a></td>........

 

I've been messing with html form and button type with no success. This code does the job but I prefer a button.

 

Thanks

Link to comment
Share on other sites

so why not use the same code and use an image instead of text?

 

Anyways...

 

in order to mimic that with a form without changing anything in add_cart.php, the code would look something like this:

echo <<<FORMENT
<form name="someform" action="add_cart.php" method="get">
<input type="hidden" name="pid" value="{$row1['item_id']}" />
<input type="submit" value="Add to Cart" />
</form>
FORMENT;

Link to comment
Share on other sites

<a href="add_cart.php?pid=' . $row1['item_id'] . '"><input type="button" value="add to cart" name="Addtocart" /></a>

 

Just make the button or image or whatever in between your anchor tags.

 

I've tried this. For some reason this doesn't work for me. I get the  button but clicking does nothing. Image doesn't work but text does.  :confused:

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.