Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5962517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:07:00+00:00 2026-05-22T19:07:00+00:00

Here is my code: <?php foreach ($users as $user) { //some php code here

  • 0

Here is my code:

<?php foreach ($users as $user)
{
   //some php code here to define variables
   <a href="<?php echo ADDRESS; ?>messageSent.php?id=<?php echo $id_to; ?>" class="charcoal_link" style="line-height: 20px;" onclick="showMessageArea(this); return false;" >
      <?php echo $uniqueCode1;?><span class="pink_text"><?php echo $uniqueCode2;?></span><?php echo $uniqueCode3;?>
   </a>      
   <form id="message_area_<?php echo $id_to; ?>" style="display:none"  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>
       <input type='hidden' name='mid' id='message_id' value=""></input>
   </form>
 <?php
  }
 ?>

then i have:

<script type="text/JavaScript">
function showMessageArea(link)
{
  document.getElementById('message_id').value = this.id;
  var message_area = document.getElementById('message_area_'+this.id);
  message_area.parentNode.removeChild(message_area);
  link.parentNode.insertBefore(message_area, link.nextSibling);
  message_area.style.display="block";
}

my pagesource shows this: note that form id is unique

<a href="http://www-rainbowcode-mobi/messageSent.php?id=36" class="charcoal_link" style="line-height: 20px;" onclick="showMessageArea(this); return false;" > 
    KUZELJA<span class="pink_text">000</span>RC
</a>      
<form id="message_area_36" style="display:none"  method="post" action="http://www-rainbowcode-mobi/messageSent.php?id=36"> 
   <textarea name="message" rows="10" cols="20"></textarea> 
   <input name="Submit" type="submit" value="Send"></input> 
   <input type='hidden' name='mid' id='message_id' value=""></input> 
</form> 
<a href="http://www-rainbowcode-mobi/messageSent.php?id=38" class="charcoal_link" style="line-height: 20px;" onclick="showMessageArea(this); return false;" > 
   ALANZIM<span class="pink_text">000</span>RC 
</a>      
<form id="message_area_38" style="display:none"  method="post" action="http://www-rainbowcode-mobi/messageSent.php?id=38"> 
   <textarea name="message" rows="10" cols="20"></textarea> 
   <input name="Submit" type="submit" value="Send"></input> 
   <input type='hidden' name='mid' id='message_id' value=""></input> 
</form> 

the problem NOW is: in my JS this.id is undefined????? THUS NOT showing my textarea and sumbit button
how can i get var message_area = document.getElementById(‘message_area_’+this.id) unique???
i also tried to split.link(“=”)[1] to get id and concatenate it with message_area_
but it is not working
link is also unique, http://www-rainbowcode-mobi/messageSent.php?id=36 where id will be the id of the uniquecode link i clicked on

PLEASE i need help?
thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:07:00+00:00Added an answer on May 22, 2026 at 7:07 pm

    There are two options:

    1) add id="<?php echo $to_id; ?>" to your <a> tags, OR

    2) better pass the id as javascript function parameter:

    <a ... onclick="showMessageArea(this, '<?php echo $to_id; ?>'); return false;">
    

    and then your javascript function should look like this

    function showMessageArea(link, id)
    {
        document.getElementById('message_id').value = id;
        var message_area = document.getElementById('message_area_'+id);
        ....
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

here is the code <php? $id1 =1; $id2 = module 1 loaded; echo $var1=$id1,$var2=$id2;
Here is my PHP code $xml= new SimpleXmlElement($rawxml); foreach($xml->children()->children() AS $key){ $id = $xml->{id};
Here's the code. Not much to it. <?php include("Spreadsheet/Excel/Writer.php"); $xls = new Spreadsheet_Excel_Writer(); $sheet
Edit: The code here still has some bugs in it, and it could do
We have some old C code here that's built with nmake. Is there an
I have a piece of code here that i really could use some help
When I use PHP header redirection, all session variables are lost... Some people say
See here: http://code.google.com/p/ie7-js/ Does anyone have any experience or remarks about this javascript? Is
I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var
I am using pseudo-code here, but this is in JavaScript. With the most efficient

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.