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

  • SEARCH
  • Home
  • 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 7851725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:15:04+00:00 2026-06-02T19:15:04+00:00

I am using a query to populate a list of messages by using a

  • 0

I am using a query to populate a list of messages by using a loop, here’s my code:

<?php
$sql_i_msg_sent_waiting="SELECT t1.i_message_id,t2.username,t2.name,t2.propic,t2.age,t2.dob,t3.religion,t3.caste 
FROM candidate_i_message as t1, candidate_register_table as t2, candidate_social_table as t3 WHERE t1.from_username='$_SESSION[logged_user]' AND t1.to_username=t2.username AND t2.username=t3.username AND t1.status='0'";
$result_i_msg_sent_waiting=mysql_query($sql_i_msg_sent_waiting,$con);
$count=mysql_num_rows($result_i_msg_sent_waiting);
echo $count;

?>



<div id="section_i_message_sent_waiting" style="width:650px; overflow:auto;">
         <h2>Awaiting Sent Request</h2> 
          <?php
          if(mysql_num_rows($result_i_msg_sent_waiting)==0)
           {
            ?>
            <div style="width:650px; border-bottom:1px solid #CCCCCC" align="center">
            <table border='0' cellspacing='0' cellpadding='0' width='550px' align='center'>
            <tr style='padding-botton:5px; border-bottom:1px solid #CCCCCC'>
            <td width='50px'/>
            <td><FONT COLOR=red FACE='Geneva, Arial' SIZE=2>
                       No Messages Found.</FONT></td>
                    <td width='50px'/></tr></table>
            </div>      

         <?php
         }
         else
         {
         while($row_i_msg_sent_waiting=mysql_fetch_array($result_i_msg_sent_waiting))
         {
         ?>
         <div style="width:650px; border-bottom:1px solid #CCCCCC" align="center">
           <table width="550px" cellpadding="0" cellspacing="0" border="2" align="center" style="vertical-align:middle">
           <tr style='vertical-align:middle'>
           <td style='vertical-align:middle' width="100px">
           <form method='post' action='id.php' name='showid' id='showid'>
           <input type='hidden' name='pro_username' id='pro_username' 
             value="<?php echo $row_i_msg_sent_waiting['username'];?>"/>
                     <input type='image' src='<?php echo $row_i_msg_sent_waiting['propic'];?> ' style="width:100px; vertical-align:middle"/>
         </form>
           </td>
           <td style='vertical-align:middle;border-right:1px solid #CCCCCC;border-top:1px solid #CCCCCC' width="450px" >
               <table width="450px" cellpadding="0" cellspacing="0" border="0">
                 <tr>
                 <td width="10px"/>
                 <td width="100px" align="left">Name</td>
                 <td width="10px">:</td>
                 <td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['name'];?>
                 </td>
                 <td width="10px">
                 <td width="100px" align="left">Age</td>
                 <td width="10px">:</td>
                 <td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['age'];?>
                 </td>
                 <td width="10px"/>
                 </tr>
                  <tr>
                 <td width="10px"/>
                 <td width="100px" align="left">Date Of Birth</td>
                 <td width="10px">:</td>
                 <td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['dob'];?>
                 </td>
                 <td width="10px">
                 <td width="100px" align="left">Religion</td>
                 <td width="10px">:</td>
                 <td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['religion'];?>
                 </td>
                 <td width="10px"/>
                 </tr>
                 <tr>
                 <td width="10px"/>
                 <td width="100px" align="left">Caste</td>
                 <td width="10px">:</td>
                 <td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['caste'];?>
                 </td>
                 <td width="10px">
                 <td width="100px" align="left">Religion</td>
                 <td width="10px">:</td>
                 <td width="100px" align="left"><?php echo $row_i_msg_sent_waiting['religion'];?>
                 </td>
                 <td width="10px"/>
                 </tr>
                 <tr>
                 <td width="10px"/>
                 <td width="100px" align="left">Action</td>
                 <td width="10px">:</td>
                 <td width="100px" align="left">
                 <form method="post" name="cancel_request_form"  id="cancel_request_form"
                 action="javascript:cancel_request(document.getElementById('cancel_request_form'));">
                 <input type="text" name="no_of_msg" id="no_of_msg" value="<?php echo $count;?>"/>
                    <input type="text" name="cancel_request[]" id="cancel_request[]" 
                    value="<?php echo $row_i_msg_sent_waiting['i_message_id'];?>"/>
                    <input type="submit" name="cancel" id="cancel" class="button" style="width: 100px" value="Cancel Request"/>
                    </form>
                 </td>
                 <td width="10px">
                 <td width="100px" align="left"></td>
                 <td width="10px">:</td>
                 <td width="100px" align="left">
                 </td>
                 <td width="10px"/>
                 </tr>
                             </table>
           </td>
           </tr>

           </table>
         </div>
         <?php 
         } 
         }?>

</div>

the line

<input type="text" name="cancel_request[]" id="cancel_request[]" 
                    value="<?php echo $row_i_msg_sent_waiting['i_message_id'];?>"/>

                creates a array of input type text, and each input text contains corressponding message_id...since each input text is contained within a form, and since the form is within a loop, the form is also repeatative..when the submit button will be clicked corressponding to a particular form, the input type text[] within that form will fire the value to get accepted in the javascript i give below...

<script>
function cancel_request(obj) {

alert(document.getElementByName('cancel_request[]').value);
}
</script>

But the script is showing problem, it’s not working at all. I don’t know what’s wrong. It’s not displaying anything. There is message_id 1 and 2: one text type input[] contains value 1, another value 2.

When I click the submit button corresponding to value 1, the value of that text type input will be send to JavaScript and displayed. What’s the problem with my script?

  • 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-06-02T19:15:05+00:00Added an answer on June 2, 2026 at 7:15 pm

    The function is getElementsByName – Elements in the plural. You then access it like an array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using application builder and setting up select boxes to populate a query
I am trying to populate an HTML select list using an array of customer
Is there is any way to get the select Random Records using query from
I am using this query: SELECT DISTINCT pat.PublicationID FROM dbo.PubAdvTransData AS pat INNER JOIN
I am using SQL Query and below are the tables. Organization OrgID Name RAOGID
I'm using caml query to select all documents which were modified or added by
I am using SQL Query and below are the tables. Organization OrgID Name RAOGID
I am using SQL Query and below are the tables. Organization OrgID Name RAOID
Basically, I have populated a dropdown list using php from a database on a
I have an list of paged results that is using AJAX requests to populate

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.