开发者

can i append some php to a form action?

i have the following which is within a foreach loop and lists the unique code as a link:

<a href="" class="charcoal_link" style="line-height: 20px;" onclick="showMessageArea(this); return false开发者_Python百科;" >
  <?php echo $uniqueCode1?><span class="pink_text"><?php echo $uniqueCode2?></span><?php echo $uniqueCode3?>
</a>
<form id="message_area" style="display:none" enctype="multipart/form-data" method="post" action="<?php echo ADDRESS; ?>messageSent.php?id=<?php echo $id_to ?>">
   <textarea name="message" rows="10" cols="20"></textarea>
   <input name="Submit" type="submit" value="Send"></input>
 </form>

i want to pass the id of the uniquecode i clicked on but $id_to = the first link's id i also tried to pass $id_to as a hidden field inside the form tag but still it takes the id of the first uniquecode link regardless of which link i click on

please help? thank you


You messed up with ".

Try with:

<form id="message_area" style="display:none" method="post" action="<?php echo ADDRESS; ?>messageSent.php?id=<?php echo $id_to ?>">


The form action can be another PHP script which can read POSTed variables. Add id as a hidden field to POST.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜