0

I'm try to run a while loop, i also want jquery form to process it so the page doesn't refresh. So far the code work, but it only used the jquery function on the first loop and for the others loops it open new page. I need some help solving this problem. thanks in advance... (code)

    $query = mysql_query("SELECT * FROM linkUP_message WHERE to_mem='$from_mem'
            AND to_mem_burn='2' AND new_message='3' ORDER BY id DESC");
    $num_rows = mysql_num_rows($query);
        if ($num_rows < 1) {
    echo '<div id="new_message" class="addlinkuplinks a">&nbsp;You have no 
            message at this time.&nbsp;</div>';
    }else {
        while($row = mysql_fetch_array($query)){
            $msg_id = $row['id'];
            $msg_to_mem = $row['to_mem'];
            $msg_from_mem = $row['from_mem'];
            $msg_from_memID = $row['from_memID'];
            $msg_subject = $row['subject'];
            $msg_content = $row['content'];
            $msg_date = $row['date'];
            $msg_from_mem_burn = $row['from_mem_burn'];
            $msg_to_mem_burn = $row['to_mem_burn'];


      $sqlName=mysql_query("SELECT * FROM prociallinkup_members WHERE 
              email<>'$from_mem' AND email='$msg_from_mem' LIMIT 1")or die ("Sorry we
              have a mysql error!");
      while($row=mysql_fetch_array($sqlName)){
          $msg_from_memAccount=$row["accountType"];
          $msg_from_memID=$row["hdw_id"];
          $msg_from_memEmail=$row["email"];
          $msg_from_memfirstName=$row["firstName"];
          $msg_from_memlastName=$row["lastName"];
          $msg_from_mem_pic=$row["profile_pic"];
          $gender=$row["gender"];}


      echo '

     <div id="linkUPmsg" class="linkUPmsg">
     <table width="100%">
       <tr>
       <tr><td width="60%"align="left" valign="top"><span style="font-size:
               12px; color: #CCCCCC;">Read Date:</span></td>
             <td width="40%"align="right" valign="top"><span style="font-size: 12px;
                color: #CCCCCC;">'.$msg_date.'</span></td>
       </tr>
     <table width="100%">
     <tr>
     <td width="5%" align="left">'.$profile_pic.'</td>
      <td width="87%"align="left" ><span style="font-size: 14px; font-weight:
    bold; color: #999999;">'.$msg_from_memfirstName.' '.$msg_from_memlastName.'</span>
      <div id="requestlinkUP_text">Send you this message!</div>
      <div id="requestlinkUP_text"">Subject: <span style="font-size: 12px; 
     font-weight: bold; color: #0066CC;">'.$msg_subject.'</span></div>
      </td>

      <div id="readmember_msg"></div>
     <td width="3%" align="right"><div id="linkUPmsg_readR"><form id="readForm"
  action="read_message.php" class="readform" method="get" enctype="multipart/form-data"
   name="acceptlinkUP">
     <input name="RfirstName" id="RfirstName" type="hidden"
   value="'.$msg_from_memfirstName.'" />
     <input name="RlastName" id="RlastName" type="hidden" 
   value="'.$msg_from_memlastName.'" />
     <input name="Remail" id="Remail" type="hidden" 
   value="'.$msg_from_memEmail.'" />
    <input name="Rdate" id="Rdate" type="hidden" value="'.$msg_date.'" />
     <input name="Rcontent" id="Rcontent" type="hidden" 
    value="'.$msg_content.'" />
     <input name="Rsubject" id="Rsubject" type="hidden"
   value="'.$msg_subject.'" />
     <input name="Rmsg_id" id="Rmsg_id" type="hidden" value="'.$msg_id.'" />
     <input name="Rto_mem" id="Rto_mem" type="hidden" value="'.$msg_from_mem.'"
              />
     <input name="read_linkUPmsg" class="msgAction" type="image" 
    src="/image/read_mail.png" width="25" height="25"/>
    </form></div></a>

     </td>


      <td width="5%" align="right"><div id="linkUPmsg_burnR"
      class="addlinkuplinks"><form id="burnForm_read" action="/burn_message.php" 
      class="burnForm_read" method="get" enctype="multipart/form-data"
      name="burnlinkUP">
      <input name="msg_id" type="hidden" value="'.$msg_id.'" />
      <input name="to_mem" type="hidden" value="'.$msg_from_mem.'" />
     <input name="burn_linkUPmsg" class="msgAction" type="image"
       src="/image/burn_sign.png" width="20" height="25"/>
     </form></div><div id="burnmember_msg"></div></a>
    </td>

      </tr>
      </table>
      </span>
      </div>
      &nbsp;
              <script type="text/javascript" src="/jquery.js"></script>
    <script type="text/javascript" src="/jquery.form.js"></script>
    <script type="text/javascript" src="/jquery.validate.js"></script>  

      <script type="text/javascript">
      $("document").ready(function()
      {

      $("#burnForm_read").ajaxForm( {
      target: "#burnmember_msg",
      success: function() { 
      $("#linkUPmsg_readR").hide();
      $("#linkUPmsg_burnR").hide(); 


  } 
  });
  });
  </script> 

   ';
}
   }

1 Answer 1

1

You need to use array for input type names , as;

<input name="Rdate[]" id="Rdate" type="hidden" value="'.$msg_date.'" />
//do this for all your input fields
//and the on php side do 
print_r($_POST);
Sign up to request clarification or add additional context in comments.

3 Comments

don't know how to do print_r($_POST); on php side (new to coding, I'm learning) could u please show me an example.
@Kasagi You would use print_r($_POST); on the read_message.php file. That's where the form is sending the data. print_r Is just going to show you what data was sent to the page. Used mainly for debugging.
how does that help me, i need help with the jquery script. the data are coming to the page fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.