Jump to content

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

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.