Jump to content

Post Form Link Submit Button?


jordan443

Recommended Posts

I'm making a manga (Japanese comic) reading site and on the front page it shows the latest feed of new manga from another site using this code:


http://pastebin.com/dsQzbJRX


That works fine but now I want to somehow turn each link on the page into a POST form submit button that posts the name of the manga to '/description.php'


Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/277222-post-form-link-submit-button/
Share on other sites

If you are just asking how to make an anchor link send POST data, you can't without using Javascript. You can either use AJAX or some workaround like this:

<form method="POST" action="/description.php">
<input type="hidden" name="manga" value="value"/>
<a href="anything" onclick="this.parentNode.submit();return false">link</a>
</form>

If you have a bunch of them it would probably be better to do something like this:

<form id="theform" method="POST" action="/description.php">
<input type="hidden" name="manga" value="value"/>
</form>
<a href="anything" onclick="document.forms.theform.manga.value='something';document.forms.theform.submit();return false">link</a>
<a href="anything" onclick="document.forms.theform.manga.value='somethingelse';document.forms.theform.submit();return false">link</a>

You really should just use GET

POF does it with:

<div style="float:left;margin-bottom: 15px;padding-left:24px;">
<a href="javascript: B('http://pics.pof.com/dating/168/51/13rv1hbww3d1ndg3vgx4zpomx289470751.2.jpg','')">
<img border="0" alt="" onmouseout="hidetrail();" onmouseover="showtrail('http://pics.plentyoffish.com/dating/168/51/13rv1hbww3d1ndg3vgx4zpomx289470751.2.jpg',225);" src="http://pics.pof.com/thumbnails/168/51/13rv1hbww3d1ndg3vgx4zpomx289470751.2.jpg">
</a>
</div>

It's similar to AngularJS

Archived

This topic is now archived and is closed to further replies.

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