Jump to content

blepblep

Members
  • Posts

    89
  • Joined

  • Last visited

    Never

Posts posted by blepblep

  1. $post = filter_var_array($_POST,FILTER_SANITIZE_STRING);

    that should do it :)

     

    Where do I put that? In here?

     

    function sanitize_data($data)
        {
            $data = mysql_real_escape_string(trim($data));
            return $data;
        }
    
    $post = filter_var_array($_POST,FILTER_SANITIZE_STRING);
        
    $post = array(); 
    foreach($_POST as $key =>$value){
    $post[$key] = sanitize_data($value);
    

  2. Hi, wondering can anyone help me here. I have the following function sanitize -

     

    function sanitize_data($data)
        {
            $data = mysql_real_escape_string(trim($data));
            
        }
    
    $post = array(); 
    foreach($_POST as $key =>$value){
    $post[$key] = sanitize_data($value);
    
    

     

    I need to change it to this function_sanitize -

     

    
    function sanitize_data()
    {
    foreach($_POST as $name => $value)
    {
    	if (is_array($value))
    	{
    		for ($i = 0; $i < count($value); $i++)
    		{
    			$value[$i] = htmlspecialchars($value[$i], ENT_QUOTES);
    			$value[$i] = stripslashes($value[$i]);
    			$value[$i] = mysql_real_escape_string($value[$i]);
    		}
    		$_POST[$name] = $value;
    	}
    	else
    	{
    		$_POST[$name] = htmlspecialchars($value, ENT_QUOTES);
    		$_POST[$name] = stripslashes($_POST[$name]);
    		$_POST[$name] = mysql_real_escape_string($_POST[$name]);
    	}
    }
    }
    sanitize_data();
    
    

     

    The reason I need to do this is because a user fills in a text field, but I get an SQL error when someone enters a special character like ' % ^ & " etc. The second function_sanitize I posted works in my other forms but for this one it doesnt.

     

    Would anyone have any ideas how I can implement the second function into the first one? Or a way to enter special characters. Thanks

  3. Ahhh ok, I see what you mean. Thanks for that. Is there a way I can do it like this?

     

    15367wg.jpg

     

    And then, depending on what is selected, send an email to that address?

     

    Am I wrong in saying how you have it done for me, it will display 3 links that I can click on each time, so instead of just showing one link it will show however many is created?

  4. Instead of forms, could you links?

     

    <tr><th>Review Forum</th><th>Review ID</th><th>Send E-mail</th></tr>
    <tr><td>TC CNOSS</td><td>TC19</td><td><a href="sendMomEmail.php?sendemail=TCCNOSS">Send e-mail to TC CNOSS</a></td></tr>

     

     

    The links could be processed with a switch():

     

    <?php
    switch($_GET['sendemail']) {
    case 'TCCNOSS':
    	$toEmail = 'TCCNOSS@test.com';
    	break;
    }
    
    // The message
    $message = "Line 1\nLine 2\nLine 3";
    
    // In case any of our lines are larger than 70 characters, we should use wordwrap()
    $message = wordwrap($message, 70);
    
    mail($toEmail, 'My Subject', $message);
    ?>

     

    I can't use links like that. The Review Forum and Review ID I posted in the screenshot from search result so they are different each time.

     

    Could you explain this to me please -

     

    <td><a href="sendMomEmail.php?sendemail=TCCNOSS">Send e-mail to TC CNOSS</a></td></tr>

     

    How will the above work if it is a different forum to TC CNOSS? As there is 9 possible ones and I don't no how that would work with the

    sendemail = TCCNOSS

    part?

     

    These are the different forums - TC CNOSS, TC PM, TC OSS RC, TC Arch Board,  TC TOR, TC PF, TC WRAN, TC GRAN, TC Navigator.  I am wondering how could I do it the way you described but instead of naming the link TC CNOSS as this could be different depending on what Review Forum it is..

  5. What does your form code look like?

     

    It is incredibly messy, the first half of it was coded by myself and the second by someone else. Heres a snippet of mine with the code getting the reviewForum. The reviewForum is what I want to send the email to, so instead of having a drop down menu that contains the 9 forums, I just want to have some sort of condition that checks if it is TC CNOSS send an email to tcnoss@email.com, if it is TC TOR send an email to tctor@email.com etc etc.. Is this possible do you think?

     

    <tr>
    	<th>Review Forum</th>
    
    </tr>		
    	<td>"	.	custOut($row['reviewForum'])	.	"</td>

     

    24bogif.jpg

     

    My button code -

    <td>
    <form id='sendEmail' action = \"sendMomEmail.php\" method = \"post\">
    	<input type = \"submit\" value = \"Send email for approval\" style='display:inline;' onclick =\"sendMomEmail.php\">
    </form>	
    </td>
    

  6. This was the original idea I had in my head as to how I was going to code it but it doesnt work -

     

    $email_location = $_POST['location']; // the value from your form
    
    if($email_location == "Atlanta") { // a form value and a location
        $your_email = "atlanta@email.com"; // the email for that location
    } else if ($email_location == "Colorado") {
        $your_email = "colorado@email.com";
    } else if ($email_location == "Virginia") {
        $your_email = "virginia@email.com";
    } else if ($email_location == "Kansas City") {
        $your_email = "kansas@email.com";
    } else { // if no one is good, send it to this email
        $your_email = "standard@email.com";
    }

  7. What I want to do is to send an email to an address based on a forum. There is 9 forums to choose from in a drop down menu but these are hard coded in. Sorry I shouldn't have set the variable of the post outside the if statement. My bad sorry!

     

    I dont no how I can send an email based on a certain form that the user selects.

  8. Hi, wondering could anyone help me here again. I have been asked to implement a email feature depending on a selection. I've seen plenty of examples online about doing it from a drop down, but I need to do it without a drop down menu.

     

    The user has 9 forms to choose from. Each of these forms has a name, say TC CNOSS, TC OSS RC etc for example (These forms are selected from a drop down menu but this drop down menu is not populated from the database, it is hard coded). When the user fills in a form, they get an ID which they enter to a search menu. This returns the form they filled in, but with a small bit of extra information needing to be filled in. After they fill in this extra bit of information, I have a button that says 'Send to X for approval'. This button goes to another page which performs the below code -

     

    Now the part I am stuck at is, how do I send an email to say TC CNOSS if the user is filling in a form of TC CNOSS? I just want the email to say 'TC Number 10 needs to be approved' and then include a link to my site.

     

    <?php
    
    $reviewForum = $post['reviewForum'];
    
    if(isset($_POST['submit']))
    {
    if ($post['reviewForum'] = 'TC CNOSS') {
    
    // The message
    $message = "Line 1\nLine 2\nLine 3";
    
    // In case any of our lines are larger than 70 characters, we should use wordwrap()
    $message = wordwrap($message, 70);
    
    // Send
    mail('testemail@test.com', 'My Subject', $message);
    
    }
    }
    ?>

     

    Thanks to anyone who can help, if there is any more info needed just ask.

  9. @smoseley - It's just how it is. I'm only a student doing work placement here so I can't really argue with what work I'm given you know? I understand where your coming from and it does seem pointless to me too but it has to be done  :-\

     

    They want everything done for them, in their own words "It shouldn't take more than 3 or 4 clicks to have something done/get somewhere."

     

    @ManiacCan, see above. I'm only here till 31st August though so its not too bad. Not at all what I thought it would be when I first came in given the massive size of the company and all its employees around the world.

  10. let's swap things round a little

     

        <?php
            mysql_connect("$host", "$username", "$password")or die("cannot connect");
    
            mysql_select_db("$db_name")or die("cannot select DB");
              
            $user_result = "SELECT review.*, mom.*, action.*, remark.* FROM review
            LEFT JOIN mom on review.reviewId = mom.reviewId
            LEFT JOIN remark on review.reviewId = remark.reviewId
            LEFT JOIN action on review.reviewID = action.reviewId
            WHERE review.reviewId IN ( ".$_POST['reviewIds']." )";
    
            $qry = mysql_query($user_result) OR die(mysql_error());
    
    echo "<h1>TC Tool Minutes of Meeting</h1>";
    while ($user_array = mysql_fetch_assoc($qry)) {
    
            echo "<table width='100%'>";
            // header row
            echo "<tr>                                                  
                    <th>Review Forum</th>
                    <th>Review ID</th>
                    <th>Document Title</th>
                    <th>Document Number</th>
                    <th>Document Type</th>
                    <th>Project Name</th>
                    <th>Author Name</th>
                    <th>Chairperson</th>
                  <tr>";
            
                    
                // data row
                echo //"tr> <- Puts a space under Review forum and its value.
                    "                                                
                      <td>{$user_array['reviewForum']}</td>
                      <td>{$user_array['reviewId']}</td>
                      <td>{$user_array['docTitle']}</td>
                      <td>{$user_array['docNumber']}</td>
                      <td>{$user_array['docType']}</td>
                      <td>{$user_array['projectName']}</td>
                      <td>{$user_array['authorName']}</td>
                      <td>{$user_array['chairPerson']}</td>
                     ";
            
            echo "</table>"; 
            
            echo "<table width='100%'>";
            echo "<tr> 
                    <th>Revision</th>
                    <th>CDM Link</th>
                       <th>Main Requirement ID</th>
                    <th>Mars Link</th>
                       <th>Checklist Link</th>
                       <th>Link Internal 1/3</th>
                    <th>Impacted Products</th>
                    <th>Scope</th>
                    <th>Impacted Products 2</th>
                    <th>Review Class</th>
                    <th>Review Type</th>
                    <th>Earliest Date</th>
                    <th>Latest Date</th>
                    <th>Previous TC Reviews</th>
                    <th>Required Attendees</th>
                    <th>Optional List</th>
                    <th>Information Only</th>
                    <th>Review Duration</th>
                    <th>Document Abstract</th>
                  </tr>";
    
                // 2nd data row
                echo "<tr>
                <td>{$user_array['revision']}</td>
                <td>{$user_array['cdmLink']}</td>
                <td>{$user_array['mainReqId']}</td>
                <td>{$user_array['marsLink']}</td>
                <td>{$user_array['checklistLink']}</td>
                <td>{$user_array['linkInternalOneThird']}</td>
                <td>{$user_array['impactedProducts']}</td>
                <td>{$user_array['abstract']}</td>
                <td>{$user_array['impactedProducts2']}</td>
                <td>{$user_array['reviewClass']}</td>
                <td>{$user_array['reviewType']}</td>
                <td>{$user_array['earliestDate']}</td>
                <td>{$user_array['latestDate']}</td>
                <td>{$user_array['previousTcReviews']}</td>
                <td>{$user_array['requiredAttendees']}</td>
                <td>{$user_array['optionalAttendees']}</td>
                <td>{$user_array['informationOnly']}</td>
                <td>{$user_array['reviewDuration']}</td>
                <td>{$user_array['docAbstract']}</td>
                </tr>";
            echo "</table>";
            }
    
            mysql_close();
        ?>
    

     

    Sorry for the late reply Barand, I was finished work on Friday.

     

    The above works perfectly, thank you! I have another question to ask you about, sorry :)

     

    See the screenshot below, is there a way to widen the document itself so all of the information is visible? See how on the right here the column gets very narrow? The part where it is narrow is the last column -

     

    21oribl.jpg

     

     

     

    EDIT - Sorry, its a Monday morning :P I just put some of the results into another table so their on the next row.

  11. I've come across a bit of a problem and I have a feeling I no how to fix it but it is a longer way, but I am wondering is there a way I solve it without creating more queries. I have another row underneath my first results and it is viewable when I click expand. I am trying to do the same thing in Word but without the expand, so just have it displaying but on another row. This is how it is on the website at the moment -

     

    HxGPg.jpg

     

     

    My code at the moment is like this -

    echo "<h1>TC Tool Minutes of Meeting</h1>";
            echo "<table>";
            // header row
            echo "<tr>                                                  
                    <th>Review Forum</th>
                    <th>Review ID</th>
                    <th>Document Title</th>
                    <th>Document Number</th>
                    <th>Document Type</th>
                    <th>Project Name</th>
                    <th>Author Name</th>
                    <th>Chairperson</th>
                  <tr>";
            
                    
            while ($user_array = mysql_fetch_assoc($qry)) {
                // data row
                echo //"tr> <- Puts a space under Review forum and its value.
                	"                                                
                      <td>{$user_array['reviewForum']}</td>
                      <td>{$user_array['reviewId']}</td>
                      <td>{$user_array['docTitle']}</td>
                      <td>{$user_array['docNumber']}</td>
                      <td>{$user_array['docType']}</td>
                      <td>{$user_array['projectName']}</td>
                      <td>{$user_array['authorName']}</td>
                      <td>{$user_array['chairPerson']}</td>
                     ";
            }
            echo "</table>"; 
            
            echo "<table>";
            echo "<tr> 
                    <th>Revision</th>
                    <th>CDM Link</th>
                   	<th>Main Requirement ID</th>
                    <th>Mars Link</th>
                   	<th>Checklist Link</th>
                   	<th>Link Internal 1/3</th>
                    <th>Impacted Products</th>
                    <th>Scope</th>
                    <th>Impacted Products 2</th>
                    <th>Review Class</th>
                    <th>Review Type</th>
                    <th>Earliest Date</th>
                    <th>Latest Date</th>
                    <th>Previous TC Reviews</th>
                    <th>Required Attendees</th>
                    <th>Optional List</th>
                    <th>Information Only</th>
            		<th>Review Duration</th>
                    <th>Document Abstract</th>
                  </tr>";
    
            while ($user_array = mysql_fetch_assoc($qry)) {
            	// data row
            	echo //"<tr> <- Puts a space under Review forum and its value.
            	"
            	<td>{$user_array['revision']}</td>
            	<td>{$user_array['cdmLink']}</td>
            	<td>{$user_array['mainReqId']}</td>
            	<td>{$user_array['marsLink']}</td>
            	<td>{$user_array['checklistLink']}</td>
            	<td>{$user_array['linkInternalOneThird']}</td>
            	<td>{$user_array['impactedProducts']}</td>
            	<td>{$user_array['abstract']}</td>
            	<td>{$user_array['impactedProducts2']}</td>
            	<td>{$user_array['reviewClass']}</td>
            	<td>{$user_array['reviewType']}</td>
            	<td>{$user_array['earliestDate']}</td>
            	<td>{$user_array['latestDate']}</td>
            	<td>{$user_array['previousTcReviews']}</td>
            	<td>{$user_array['requiredAttendees']}</td>
            	<td>{$user_array['optionalAttendees']}</td>
            	<td>{$user_array['informationOnly']}</td>
            	<td>{$user_array['reviewDuration']}</td>
            	<td>{$user_array['docAbstract']}</td>
            	";
            	}
            echo "</table>";
    

     

    And I get this in word when the above code runs -

     

    kJgBU.jpg

     

    So it is calling the

    mysql_fetch_array

    twice.

     

    Is there a way I can get it to run without creating another query and inserting it into the second table? Even have the second results inside the while loop but printing out in Word the same as my web page?

  12. you will need to adjust the column names

        <?php
            mysql_connect("$host", "$username", "$password")or die("cannot connect");
    
            mysql_select_db("$db_name")or die("cannot select DB");
              
            $user_result = "SELECT review.*, mom.*, action.*, remark.* FROM review
            LEFT JOIN mom on review.reviewId = mom.reviewId
            LEFT JOIN remark on review.reviewId = remark.reviewId
            LEFT JOIN action on review.reviewID = action.reviewId
            WHERE review.reviewId IN ( ".$_POST['reviewIds']." )";
    
            $qry = mysql_query($user_result) OR die(mysql_error());
    
            echo "<h1>Reviews</h1>";
            echo "<table CELLPADDING=10 border = 0 >";
            // header row
            echo "<tr>                                                  
                    <th>Review Forum</th>
                    <th>Review ID</th>
                    <th>Document Title</th>
                    <th>Document Number</th>
                    <th>Document Type</th>
                    <th>Project Name</th>
                    <th>Author</th>
                    <th>Chairperson</th>
                  <tr>";
                  
            while ($user_array = mysql_fetch_assoc($qry)) {
                // data row
                echo "<tr>                                                
                      <td>{$user_array['reviewForum']}</td>
                      <td>{$user_array['reviewId']}</td>
                      <td>{$user_array['docTitle']}</td>
                      <td>{$user_array['docNumber']}</td>
                      <td>{$user_array['docType']}</td>
                      <td>{$user_array['project']}</td>
                      <td>{$user_array['author']}</td>
                      <td>{$user_array['chairperson']}</td>
                      </tr>";
            }
    
            echo "</table>";
    
            mysql_close();
        ?>
    

     

    You really need to master the rudiments of HTML, particularly table structure in this case, before tackling PHP

     

    Thanks a million Barand, I really appreciate it. I'm a java/c++ programmer in college and I'm currently on work placement. And where I am working I needed to learn HTML, CSS, JavaScript and PHP over the past few months, so everyday is a learning day really!

  13. I incorporated your code into mine. Because you have used "*" in the SELECT clause (bad practice) there is no way of knowing your column names so I can't add more for you.

     

    The initial headers will cause it to download instead of displaying

     

    <?php
    
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"sample.html\"");
    header("Pragma: no-cache");
    header("Expires: 0");
    
    ?>
    <html>
    <head>
    <title>sample table output</title>
    <meta name="author" content="barand">
    <style type="text/css">
        th {
            background-color: #369;
            color: white;
            font-family: sans-serif;
            font-size: 10pt;
            font-weight: 700;
        }
        td {
            background-color: #eee;
            color: black;
            font-family: sans-serif;
            font-size: 10pt;
            font-weight: 300;
        }
        h1 {
            color: black;
            font-family: sans-serif;
            font-size: 12pt;
            font-weight: 700;    
        }
    </style>
    </head>
    <body>
        <?php
            mysql_connect("$host", "$username", "$password")or die("cannot connect");
    
            mysql_select_db("$db_name")or die("cannot select DB");
              
            $user_result = "SELECT review.*, mom.*, action.*, remark.* FROM review
            LEFT JOIN mom on review.reviewId = mom.reviewId
            LEFT JOIN remark on review.reviewId = remark.reviewId
            LEFT JOIN action on review.reviewID = action.reviewId
            WHERE review.reviewId IN ( ".$_POST['reviewIds']." )";
    
            $qry = mysql_query($user_result) OR die(mysql_error());
    
            echo "<h1>Reviews</h1>";
            echo "<table CELLPADDING=10 border = 0 >";
            echo "<tr>
                    <th>Review ID</th>
                  <tr>";
                  
            while ($user_array = mysql_fetch_assoc($qry)) {
                echo "<tr>
                      <td>{$user_array['reviewId']}</td>
                      </tr>";
            }
    
            echo "</table>";
    
            mysql_close();
        ?>
    </body>
    </html>

     

    Thank you so much Barand, that is exactly how I am wanting to display it!!  :D

     

    Here is my headers: Review Forum, Review ID, Document Title, Document Number, Document Type, Project Name, Author Name, Chairperson.

     

    I have a question, how you have coded it to display is fine, but when I try to add another row such as Review Forum, it appears inside the Review ID like this -

     

    2b8bV.jpg

     

    Is there a way I could have it lining up beside each other so they will appear like this -(Color doesnt matter but just the aligning right beside each other is what I am after)

     

    ybwfH.jpg

     

    And my code for the first picture -

     

          echo "<h1>Reviews</h1>";
            echo "<table CELLPADDING=10 border = 0 >";
            echo "<tr>
                    <th>Review Forum</th>
                  <tr>";
            
            echo "<table CELLPADDING=10 border = 0 >";
            echo "<tr>
                    <th>Review ID</th>
                  <tr>";
    
                  
            while ($user_array = mysql_fetch_assoc($qry)) {
                echo "<tr>
                      <td>{$user_array['reviewForum']}</td>
                      </tr>";
                echo "<tr>
            		<td>{$user_array['reviewId']}</td>
            		</tr>";
            }
    
            echo "</table>";
    

  14. Here's a sample of a simple way to do it

    <?php
    
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=\"sample.html\"");
    header("Pragma: no-cache");
    header("Expires: 0");
    
    ?>
    <html>
    <head>
    <title>sample table output</title>
    <meta name="author" content="barand">
    <style type="text/css">
        th {
            background-color: #369;
            color: white;
            font-family: sans-serif;
            font-size: 10pt;
            font-weight: 700;
        }
        td {
            background-color: #eee;
            color: black;
            font-family: sans-serif;
            font-size: 10pt;
            font-weight: 300;
        }
    </style>
    </head>
    <body>
        <?php
            include("testDBconnect.php");     // connect to DB
            include("baaGrid.php");           // easy data tables
    
            $sql = "SELECT ee_id, firstname, lastname FROM employees";
            $g = new baaGrid ($sql);
            $g->display();    
        ?>
    </body>
    </html>
    

     

    Thanks Barand. I understand the CSS side of what you posted, and the connecting to database part but what I dont no how to do is get the data from my query and insert it to a certain position IE under a header? Say I have Review ID as a header then under that I want the review id, I don't no how to put it in under there.

     

    Sorry aswell but in the code what do you mean easy data tables?

     

    include("baaGrid.php");           // easy data tables
    

     

    Here is what I have so far -

     

    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    
    mysql_select_db("$db_name")or die("cannot select DB");
      
    $user_result = "SELECT review.*, mom.*, action.*, remark.* FROM review
    LEFT JOIN mom on review.reviewId = mom.reviewId
    LEFT JOIN remark on review.reviewId = remark.reviewId
    LEFT JOIN action on review.reviewID = action.reviewId
    WHERE review.reviewId IN ( ".$_POST['reviewIds']." )";
    $qry = mysql_query($user_result) OR die(mysql_error());
    
    $user_array = mysql_fetch_assoc($qry);
    echo "<center>";
    echo "<table CELLPADDING=10 border = 0 >";
    echo "<tr>";
    echo "<th>Review ID</th>
    <tr>".$user_array['reviewId']."</tr>";
    
    echo "</tr>";
    echo "</table>";
    
    mysql_close();
    ?>
    

     

    And it takes the data from the DB and shows it on screen. This isnt much use though as ideally I want it downloading automatically to a word document.

     

    Thanks for the help so far!

     

     

    EDIT - I have added this to the file -

     

    header("Expires: 0");
    header("Cache-control: private");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Content-Description: File Transfer");
    header("Content-Type: application/vnd.ms-excel");
    header("Content-disposition: attachment; filename=export.doc");
    

     

    And it downloads straight away to a word doc and opens it also, woo! :) Can anyone tell me if that is a ok way to go about it or should i do it differently?

  15. as barand has said multiple times PUT IT INTO A HTML TABLE, MAKE IT DOWNLOAD AS .HTML AND OPEN THE .HTML WITH WORD and it will display a word table

     

    I don't no how to do that. This is all new to me so I am learning as I'm going along which is why what I am asking may seem stupid to people on here.

     

    Edit - Would it be something like in this link? http://forums.devshed.com/php-development-5/display-results-from-query-in-html-table-4095.html

  16. That wasn't my question.  I asked what they were trying to accomplish.  Why doesn't excel work?  What do they actually need?

     

    They want to be able to read the full results that are returned. Excel at the moment can be used instead of word. They need the results that are search and displayed on screen to export to an excel file.

     

    Is this possible to have the Excel formatted or will I need to use something like PHPExcel?

     

  17. They dont come from a technical background so they dont realise if stuff will work/wont work! Would it just be easier and better to download it to Excel so yeah?

     

    I'll try explain what I want better. See the image below, there my search results.

     

    9ptgf8.jpg

     

    I have a button under the results that says 'Export'. When Export is clicked that goes to another page and performs a query, then a file is downloaded with the relevant information under each heading. This way will also be accepted but if I am to do it that way it needs to be formatted, eg. Document Title has to be in bold.

     

    I have it downloading using the following code, but cannot format it. The information goes in under the relevant headers too so really I just need to figure out how to format it somehow.

     

    include 'connect_db.php';
    
    function xlsBOF() { 
        echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);  
        return; 
    } 
    
    function xlsEOF() { 
        echo pack("ss", 0x0A, 0x00); 
        return; 
    } 
    
    function xlsWriteNumber($Row, $Col, $Value) { 
        echo pack("sssss", 0x203, 14, $Row, $Col, 0x0); 
        echo pack("d", $Value); 
        return; 
    } 
    
    function xlsWriteLabel($Row, $Col, $Value ) { 
        $L = strlen($Value); 
        echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L); 
        echo $Value; 
    return; 
    }
    
    
    $query = "
    SELECT review.*, mom.*, action.*, remark.* FROM review 
    LEFT JOIN mom on review.reviewId = mom.reviewId
    LEFT JOIN remark on review.reviewId = remark.reviewId
    LEFT JOIN action on review.reviewID = action.reviewId
    WHERE review.reviewId IN ( ".$_POST['reviewIds']." )";
    
    $db = mysql_query($query);
    
        // Send Header
        header("Pragma: public");
        header("Expires: 0");
        header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); 
        header("Content-Type: application/force-download");
        header("Content-Type: application/octet-stream");
        header("Content-Type: application/download");;
        header("Content-Disposition: attachment;filename=$reviewForum-$sec.xls ");
    // ??�????????�?????????
        header("Content-Transfer-Encoding: binary ");
    
                    xlsBOF(); 
    
    			// Formats table headers in Excel file
    			xlsWriteLabel(0,0,"Review ID");
                    xlsWriteLabel(0,1,"Review Forum");
                    xlsWriteLabel(0,2,"xlsument Title");
                    xlsWriteLabel(0,3,"xlsument Number");
                    xlsWriteLabel(0,4,"xlsument Type");
                    xlsWriteLabel(0,5,"Project Name");
                    xlsWriteLabel(0,6,"Author Name");
                    xlsWriteLabel(0,7,"Chairperson");
                    xlsWriteLabel(0,8,"Revision");
                    xlsWriteLabel(0,9,"CDM Link");
                    xlsWriteLabel(0,10,"Main Requirement ID");
                    xlsWriteLabel(0,11,"MARS Link");
                    xlsWriteLabel(0,12,"Checklist Link");
                    xlsWriteLabel(0,13,"1/3 Internal Link");
                    xlsWriteLabel(0,14,"Impacted Products");
                    xlsWriteLabel(0,15,"Abstract");
                    xlsWriteLabel(0,16,"Scope");
                    xlsWriteLabel(0,17,"Impacted Products 2");
                    xlsWriteLabel(0,18,"Review Class");
                    xlsWriteLabel(0,19,"Review Type");
                    xlsWriteLabel(0,20,"Earliest Date");
                    xlsWriteLabel(0,21,"Latest Date");
                    xlsWriteLabel(0,22,"Previous TC Reviews");
                    xlsWriteLabel(0,23,"Required Attendees");
                    xlsWriteLabel(0,24,"Optional Attendees");
                    xlsWriteLabel(0,25,"Information Only");
                    xlsWriteLabel(0,26,"Review Duration");
                    xlsWriteLabel(0,27,"xlsument Abstract");
                    xlsWriteLabel(0,28,"Result");
                    xlsWriteLabel(0,29,"Date");
    
    			xlsWriteLabel(4, 0, "Minutes of Meeting:");
                    xlsWriteLabel(5, 0, "Review ID");
                    xlsWriteLabel(5, 1, "Quality Ranking of Review");
                    xlsWriteLabel(5, 2, "Correct xlsument Template");
                    xlsWriteLabel(5, 3, "Internally Reviewed");
                    xlsWriteLabel(5, 4, "Requirements Covered");
                    xlsWriteLabel(5, 5, "Correct Storage Library");
                    xlsWriteLabel(5, 6, "Reports Described");
                    xlsWriteLabel(5, 7, "Change Requests Included");
                    xlsWriteLabel(5, 8, "Opened Issues Addressed");
                    xlsWriteLabel(5, 9, "xlsument Available");
                    xlsWriteLabel(5, 10, "Statement Problem Chapter");
                    xlsWriteLabel(5, 11, "Major Comments");
                    xlsWriteLabel(5, 12, "Result");
                    xlsWriteLabel(5, 13, "Number of Major Comments");
                    xlsWriteLabel(5, 14, "Number of Minor Comments");
                    xlsWriteLabel(5, 15, "Next Review Forum");
                    xlsWriteLabel(5, 16, "Reason for Cancellation");
                    xlsWriteLabel(5, 17, "Reason for Re-Review");
                    xlsWriteLabel(5, 18, "Other Comments");
                    xlsWriteLabel(5, 19, "Date");
                    xlsWriteLabel(5, 20, "Time");
                    xlsWriteLabel(5, 21, "Venue");
                    xlsWriteLabel(5, 22, "Attendees");
                    xlsWriteLabel(5, 23, "Email Comments");
                    xlsWriteLabel(5, 26, "Sign Off");
    			xlsWriteLabel(5, 27, "Review ID");
    			xlsWriteLabel(5, 28, "Number");
    			xlsWriteLabel(5, 29, "Location");
    			xlsWriteLabel(5, 30, "Severity");
    			xlsWriteLabel(5, 31, "Responsible");
    			xlsWriteLabel(5, 32, "Status");
    			xlsWriteLabel(5, 33, "Remark");
    			xlsWriteLabel(5, 34, "Comment");
    			xlsWriteLabel(5, 35, "No.");
    			xlsWriteLabel(5, 36, "Location");
    			xlsWriteLabel(5, 37, "Responsible");
    			xlsWriteLabel(5, 38, "Status");
    			xlsWriteLabel(5, 39, "Action");
    			xlsWriteLabel(5, 40, "Comment");
    			xlsWriteLabel(5, 41, "Review ID");
    
                    $xlsRow = 1;
    			$xlsRow2 = 6;
    
    			/*
    			$result = mysql_fetch_row($db);
    
    			xlsWriteLabel(1,1 $result['reviewForum']);
    			xlsWriteLabel(1,1 $result['xlsTitle']);
    
    		   while( list
    			(
    
    			// Result section
    			$reviewId, $reviewForum, $xlsTitle, $xlsNumber, $xlsType, $projectName, $authorName, $chairPerson, $revision, $cdmLink, $mainReqId, $marsLink, $checklistLink, $linkInternalOneThird, $impactedProducts, $abstract, $scope,
    			$impactedProducts2, $reviewClass, $reviewType, $earliestDate, $latestDate, $previousTcReviews, $requiredAttendees, $optionalAttendees, $informationOnly, $reviewDuration, $xlsAbstract, 
    
    			// MOM section
    			$reviewId, $qualityRankingOfReview, $correctxlsTemplate, $internallyReviewed, $requirementsCovered, $correctStorageLibrary, $reportsDescribed, $changeRequestsIncluded, $openIssuesAddressed, $xlsAvailable, $statementProblemChapter,
    			$majorComments, $result, $numberOfMajorComments, $numberOfMinorComments, $nextReviewForum, $reasonForCancellation, $reasonForReReview, $otherComments, $date, $time, $venue, $attendees, $emailComments,$signOff,
    
    			// Remark Section
    			$reviewId, $number, $location, $severity, $responsible, $status, $remark, $comment,
    
    			// Action Section
    			$number, $location, $responsible, $status, $action, $comment, $reviewId				
    			) = mysql_fetch_row($db))
    
    			{
    					// Takes values from database and prints them to Excel file accordingly
    
    					  // Review
    					  xlsWriteNumber($xlsRow, 0, "$reviewId");
                              xlsWriteLabel($xlsRow, 1, "$reviewForum");
                              xlsWriteLabel($xlsRow, 2, "$xlsTitle");
                              xlsWriteLabel($xlsRow, 3, "$xlsNumber");
                              xlsWriteLabel($xlsRow, 4, "$xlsType");
                              xlsWriteLabel($xlsRow, 5, "$projectName");
                              xlsWriteLabel($xlsRow, 6, "$authorName");
                              xlsWriteLabel($xlsRow, 7, "$chairPerson");
                              xlsWriteLabel($xlsRow, 8, "$revision");
                              xlsWriteLabel($xlsRow, 9, "$cdmLink");
                              xlsWriteLabel($xlsRow, 10, "$mainReqId");
                              xlsWriteLabel($xlsRow, 11, "$marsLink");
                              xlsWriteLabel($xlsRow, 12, "$checklistLink");
                              xlsWriteLabel($xlsRow, 13, "$linkInternalOneThird");
                              xlsWriteLabel($xlsRow, 14, "$impactedProducts");
                              xlsWriteLabel($xlsRow, 15, "$abstract");
                              xlsWriteLabel($xlsRow, 16, "$scope");
                              xlsWriteLabel($xlsRow, 17, "$impactedProducts2");
                              xlsWriteLabel($xlsRow, 18, "$reviewClass");
                              xlsWriteLabel($xlsRow, 19, "$reviewType");
                              xlsWriteLabel($xlsRow, 20, "$earliestDate");
                              xlsWriteLabel($xlsRow, 21, "$latestDate");
                              xlsWriteLabel($xlsRow, 22, "$previousTcReviews");
                              xlsWriteLabel($xlsRow, 23, "$requiredAttendees");
                              xlsWriteLabel($xlsRow, 24, "$optionalAttendees");
                              xlsWriteLabel($xlsRow, 25, "$informationOnly");
                              xlsWriteLabel($xlsRow, 26, "$reviewDuration");
                              xlsWriteLabel($xlsRow, 27, "$xlsAbstract");
                              xlsWriteLabel($xlsRow, 28, "$result");
                              xlsWriteLabel($xlsRow, 29, "$date");
    
    					  // MOM
                              xlsWriteNumber($xlsRow2, 0, "$reviewId");
                              xlsWriteLabel($xlsRow2, 1, "$qualityRankingOfReview");
                              xlsWriteLabel($xlsRow2, 2, "$correctxlsTemplate");
                              xlsWriteLabel($xlsRow2, 3, "$internallyReviewed");
                              xlsWriteLabel($xlsRow2, 4, "$requirementsCovered");
                              xlsWriteLabel($xlsRow2, 5, "$correctStorageLibrary");
                              xlsWriteLabel($xlsRow2, 6, "$reportsDescribed");
                              xlsWriteLabel($xlsRow2, 7, "$changeRequestsIncluded");
                              xlsWriteLabel($xlsRow2, 8, "$openIssuesAddressed");
                              xlsWriteLabel($xlsRow2, 9, "$xlsAvailable");
                              xlsWriteLabel($xlsRow2, 10, "$statementProblemChapter");
                              xlsWriteLabel($xlsRow2, 11, "$majorComments");
                              xlsWriteLabel($xlsRow2, 12, "$result");
                              xlsWriteLabel($xlsRow2, 13, "$numberOfMajorComments");
                              xlsWriteLabel($xlsRow2, 14, "$numberOfMinorComments");
                              xlsWriteLabel($xlsRow2, 15, "$nextReviewForum");
                              xlsWriteLabel($xlsRow2, 16, "$reasonForCancellation");
                              xlsWriteLabel($xlsRow2, 17, "$reasonForReReview");
                              xlsWriteLabel($xlsRow2, 18, "$otherComments");
                              xlsWriteLabel($xlsRow2, 19, "$date");
                              xlsWriteLabel($xlsRow2, 20, "$time");
                              xlsWriteLabel($xlsRow2, 21, "$venue");
                              xlsWriteLabel($xlsRow2, 22, "$attendees");
                              xlsWriteLabel($xlsRow2, 23, "$emailComments");
                              xlsWriteLabel($xlsRow2, 24, "$signOff");
    					  
    					  // Remark
                              xlsWriteLabel($xlsRow2, 25, "$reviewId");
                              xlsWriteLabel($xlsRow2, 26, "$number");
                              xlsWriteLabel($xlsRow2, 27, "$location");
                              xlsWriteLabel($xlsRow2, 28, "$severity");
                              xlsWriteLabel($xlsRow2, 29, "$responsible");
                              xlsWriteLabel($xlsRow2, 30, "$status");
                              xlsWriteLabel($xlsRow2, 31, "$remark");
                              xlsWriteLabel($xlsRow2, 32, "$comment");
    					  
    					  // Action
    					  xlsWriteLabel($xlsRow2, 33, "$number");
    					  xlsWriteLabel($xlsRow2, 34, "$location");
    					  xlsWriteLabel($xlsRow2, 35, "$responsible");
    					  xlsWriteLabel($xlsRow2, 36, "$status");
    					  xlsWriteLabel($xlsRow2, 37, "$action");
    					  xlsWriteLabel($xlsRow2, 38, "$comment");
    					  xlsWriteLabel($xlsRow2, 39, "$reviewId");
      
                        $xlsRow++;
    				$xlsRow2++;
                        }
    
                         xlsEOF();
                     exit();
    
    ?>
    

  18. @SalientAnimal - I need it to download into a Microsoft Word file. I dont understand what you mean about have I tried opening the page in Notepad++?

     

    @memfiss - How do I do that?

     

    @ManiacDan - Originally it was meant to be outputted to an Excel file but I was asked to change it to Word. How do I serve it in plaintext? Is it not possible to format the page?

     

    Failing that could I use something like PHPExcel?

     

    @php-real-degree - I dont understand what you mean by it is a flat file. Hopefully it is possible!

  19. Hello people. Wondering could anyone help me on this one. I have Office 2003 so I cant use PHPWord.

     

    I have a web page that returns results from my database. I also have a button that when it is clicked, goes to a page and performs a query. At the moment, I have my page downloading as a .doc file but it is all messed up when I opened it and very unreadable. I was wondering does anyone no a way I can basically download the page itself into a .doc file or at least have it formatted in a readable manner?

     

    Here is my code, it is from an example I found online -

     

    <?php
    $DB_Server = "localhost";        //your MySQL Server
    $DB_Username = "root";           //your MySQL User Name
    $DB_Password = "vfr45tgbnhy6";   //your MySQL Password
    $DB_DBName = "tc_tool";          //your MySQL Database Name
    $DB_TBLName = "review";          //your MySQL Table Name
    
    //$sql = "Select * from $DB_TBLName";
    
    $sql = "SELECT review.*, mom.*, action.*, remark.* FROM review
    LEFT JOIN mom on review.reviewId = mom.reviewId
    LEFT JOIN remark on review.reviewId = remark.reviewId
    LEFT JOIN action on review.reviewID = action.reviewId
    WHERE review.reviewId IN ( ".$_POST['reviewIds']." )";
    
    //Optional: print out title to top of Excel or Word file with Timestamp
    //for when file was generated:
    //set $Use_Title = 1 to generate title, 0 not to use title
    $Use_Title = 1;
    
    //define date for title: EDIT this to create the time-format you need
    $now_date = DATE('d-m-Y H:i');
    
    //define title for .doc or .xls file: EDIT this if you want
    $title = "Dump For Table $DB_TBLName from Database $DB_DBName on $now_date";
    
    //create MySQL connection
    $Connect = @MYSQL_CONNECT($DB_Server, $DB_Username, $DB_Password)
    or DIE("Couldn't connect to MySQL:<br>" . MYSQL_ERROR() . "<br>" . MYSQL_ERRNO());
    //select database
    $Db = @MYSQL_SELECT_DB($DB_DBName, $Connect)
    or DIE("Couldn't select database:<br>" . MYSQL_ERROR(). "<br>" . MYSQL_ERRNO());
    //execute query
    $result = @MYSQL_QUERY($sql,$Connect)
    or DIE("Couldn't execute query:<br>" . MYSQL_ERROR(). "<br>" . MYSQL_ERRNO());
    
    //if this parameter is included ($w=1), file returned will be in word format ('.doc')
    //if parameter is not included, file returned will be in excel format ('.xls')
    IF (ISSET($w) && ($w==1))
    {
    $file_type = "msword";
    $file_ending = "doc";
    }ELSE {
    $file_type = "vnd.ms-excel";
    $file_ending = "xls";
    }
    //header info for browser: determines file type ('.doc' or '.xls')
    HEADER("Content-Type: application/$file_type");
    HEADER("Content-Disposition: attachment; filename=database_dump.doc");
    HEADER("Pragma: no-cache");
    HEADER("Expires: 0");
    
    /*    Start of Formatting for Word or Excel    */
    
    IF (ISSET($w) && ($w==1)) //check for $w again
    {
    /*    FORMATTING FOR WORD DOCUMENTS ('.doc')   */
    //create title with timestamp:
    IF ($Use_Title == 1)
    {
    	ECHO("$title\n\n");
    }
    //define separator (defines columns in excel & tabs in word)
    $sep = "\n"; //new line character
    
    WHILE($row = MYSQL_FETCH_ROW($result))
    {
    	//set_time_limit(60); // HaRa
    	$schema_insert = "";
    	FOR($j=0; $j<mysql_num_fields($result);$j++)
    	{
    	//define field names
    		$field_name = MYSQL_FIELD_NAME($result,$j);
    		//will show name of fields
    		$schema_insert .= "$field_name:\t";
    		IF(!ISSET($row[$j])) {
    		$schema_insert .= "NULL".$sep;
    	}
    	ELSEIF ($row[$j] != "") {
    	$schema_insert .= "$row[$j]".$sep;
    		}
    		ELSE {
    		$schema_insert .= "".$sep;
    		}
    		}
    		$schema_insert = STR_REPLACE($sep."$", "", $schema_insert);
    		$schema_insert .= "\t";
    		PRINT(TRIM($schema_insert));
    		//end of each mysql row
    		//creates line to separate data from each MySQL table row
    		PRINT "\n----------------------------------------------------\n";
    }
    }ELSE{
    /*    FORMATTING FOR EXCEL DOCUMENTS ('.xls')   */
    //create title with timestamp:
    IF ($Use_Title == 1)
         {
             ECHO("$title\n");
         }
         //define separator (defines columns in excel & tabs in word)
         $sep = "\t"; //tabbed character
    
    //start of printing column names as names of MySQL fields
    	FOR ($i = 0; $i < MYSQL_NUM_FIELDS($result); $i++)
    	{
    	ECHO MYSQL_FIELD_NAME($result,$i) . "\t";
    }
    PRINT("\n");
    //end of printing column names
    
    //start while loop to get data
    WHILE($row = MYSQL_FETCH_ROW($result))
    	{
    	//set_time_limit(60); // HaRa
    	$schema_insert = "";
    	FOR($j=0; $j<mysql_num_fields($result);$j++)
    	{
    	IF(!ISSET($row[$j]))
    	$schema_insert .= "NULL".$sep;
    	ELSEIF ($row[$j] != "")
    	$schema_insert .= "$row[$j]".$sep;
    	ELSE
    		$schema_insert .= "".$sep;
    	}
    		$schema_insert = STR_REPLACE($sep."$", "", $schema_insert);
    		//following fix suggested by Josue (thanks, Josue!)
    		//this corrects output in excel when table fields contain \n or \r
    		//these two characters are now replaced with a space
    		$schema_insert = PREG_REPLACE("/\r\n|\n\r|\n|\r/", " ", $schema_insert);
    		$schema_insert .= "\t";
    		PRINT(TRIM($schema_insert));
    		PRINT "\n";
    	}
    }
    
    ?>
    

     

    And here is how it opens up the file -

     

    nlXnB.jpg

     

    And when it opens -

     

    vfk21e.jpg

     

     

    If anyone could help me I'd be thankful as I'm under a bit of pressure to get this working before tomorrow.

     

  20. Hi, I'm hoping could I get some help here please. I've included a screenshot hopefully it will make it clearer as what I'm trying to do.

     

    ReCdf.jpg

     

    What I am trying to do is, see where it says John Doe in the text field beside Sign Off. I am trying to get it so when the user enters a name in the text field beside Sign Off and then clicks Sign Off, it will echo what the user enters to the disabled text field beside the Minutes of Meeting.

     

    Here is my code for the Minutes of Meeting text and field -

     

    <input type = \"text\" name = \"signOff\" id = \"signOff\" size = \"20\" readonly = \"readonly\" style = \"float:right\" value = \"" . $signOffName . "\" onclick = \"updateSignOff();\"/>
    <b>Minutes of Meeting</b></td>
    

     

    Code for updateSignOff()

     

    function updateSignOff() {
    
    document.forms[0]["signOffName"].value = document.forms[0]["signOff"].value;
    
    }
    

     

    Code for Sign Off button -

     

    <input type = \"text\" name = \"signOff\" size = \"24\" align = \"right\" value = \"" . $row['signOff'] . "\"/>  <input type=\"submit\" name=\"save\"  class = 'eBtnSubmit' value=\"Sign off\" align = \"right\" />
    

     

    I'm sure my code above is not correct/conflicting but am I right in saying I need to give the text field beside Minutes of Meeting an ID, then in my JavaScript send the text that was entered in the text field beside Sign Off to the field beside the Minutes of Meeting?

     

    Thanks for any help.

  21. Ok sorry, heres my code.

     

    saveMom.php

     

    
    
    <?php
    ///------------------------
    ///	Connecting to database
    ///------------------------
    
    include 'connect_db.php';
    
    ///-----------------------------
    ///	Inserting data into database
    ///-----------------------------
    
    function sanitize_data($data) // create the function sanitize_data
        {
            $data = mysql_real_escape_string(trim($data));
            return $data;
        }
    
    $post = array(); 
    foreach($_POST as $key =>$value){
    $post[$key] = sanitize_data($value);   // call sanitize_data using each value from the $post array{$post['quality_ranking_review']}',
    
    
    echo "
    
    <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
    <html>
    <head>
    <meta http-equiv=\"REFRESH\" content=\"3;url = http://159.107.173.47/webpages/TC_Tool/Tool2/tc_tool/searchByReviewID.php?reviewID=" . $post['reviewId'] . "\"> 
    </head>
    </html>
    
    ";
    
    }
    
    if(isset($post['save']))
    {
    
    $query = "DELETE FROM tc_tool.mom WHERE reviewId = ". $post['reviewId'];
    
    if (!mysql_query($query, $connection))
    	{
    		echo "Query failed: $query<br />" . mysql_error();
    	}
    
    $query = "INSERT INTO tc_tool.mom
    			(
    			reviewId,
    			qualityRankingOfReview,
    			correctDocTemplate,
    			internallyReviewed,
    			requirementsCovered,
    			correctStorageLibrary,
    			reportsDescribed,
    			changeRequestsIncluded,
    			openIssuesAddressed,
    			docAvailable,
    			statementProblemChapter,
    			majorComments,
    			result,
    			numberOfMajorComments,
    			numberOfMinorComments,
    			nextReviewForum,
    			reasonForReReview,
    			reasonForCancellation,
    			otherComments,
    			date,
    			time,
    			venue,
    			attendees,
    			emailComments,
    			signOff
    			)
    			values 
    			(" . 
    			"'" . $post['reviewId'] . "', " . 
    			"'" . $post['qualityRankingOfReview'] . "', " . 
    			(isset($_POST['correctDocTemplate']) ? 1 : 0) . ", " . 
    			(isset($_POST['internallyReviewed']) ? 1 : 0) . ", " . 
    			(isset($_POST['requirementsCovered']) ? 1 : 0) . ", " . 
    			(isset($_POST['correctStorageLibrary']) ? 1 : 0) . ", " . 
    			(isset($_POST['reportsDescribed']) ? 1 : 0) . ", " . 
    			(isset($_POST['changeRequestsIncluded']) ? 1 : 0) . ", " . 
    			(isset($_POST['openIssuesAddressed']) ? 1 : 0) . ", " . 
    			(isset($_POST['docAvailable']) ? 1 : 0) . ", " . 
    			(isset($_POST['statementProblemChapter']) ? 1 : 0) . ", " . 
    			(isset($_POST['majorComments']) ? 1 : 0) . ", " . 
    			"'" . $post['result'] . "', " . 
    			"'" . $post['numberOfMajorComments'] . "', " . 
    			"'" . $post['numberOfMinorComments'] . "', " . 
    			"'" . $post['nextReviewForum'] . "', " . 
    			"'" . $post['reasonForReReview'] . "', " . 
    			"'" . $post['reasonForCancellation'] . "', " . 
    			"'" . $post['otherComments'] . "', " . 
    			"STR_TO_DATE('$post[date]', '%d-%m-%Y') , " .
    			"'" . $post['time'] . "', " . 
    			"'" . $post['venue'] . "', " . 
    			"'" . $post['attendees'] . "', " . 
    			"'" . $post['emailComments'] . "', " . 
    			"'" . $post['signOff'] . "'" . 
    			"
    			)				
    			";
    
    
    	//-----------------------------
    	// Prints error if there is one
    	//-----------------------------
    
    	if (!mysql_query($query, $connection))
    	{
    		echo "Query failed: $query<br />" . mysql_error();
    	}
    
    
    
    	$query = "DELETE FROM tc_tool.remark WHERE reviewId = ". $post['reviewId'];
    
    	if (!mysql_query($query, $connection))
    	{
    		echo "Query failed: $query<br />" . mysql_error();
    	}
    
    	$rowNum = 1;
    	while (isset($_POST["remark_remark_" .$rowNum])) {
    
    
    		$query = "INSERT INTO tc_tool.remark
    			(
    			reviewId,
    			number,
    			location,
    			severity,
    			responsible,
    			remark,
    			status,
    			comment
    			)
    			values 
    			(" . 
    			$post['reviewId'] . ", " . 
    			$rowNum . ", " . 
    			"'" . $_POST["remark_location_" .$rowNum] . "', " . 
    			"'" . $_POST["remark_severity_" .$rowNum] . "', " . 
    			"'" . $_POST["remark_responsible_" .$rowNum] . "', " . 
    			"'" . $_POST["remark_remark_" .$rowNum] . "', " . 
    			"'" . $_POST["remark_status_" .$rowNum] . "', " . 
    			"'" . $_POST["remark_comment_" .$rowNum] .  "'
    				)				
    			";
    
    		if (!mysql_query($query, $connection))
    	{
    		echo "Query failed: $query<br />" . mysql_error();
    	}
    
    
    		$rowNum = $rowNum + 1;
    	}
    
    
    
    
    	$query = "DELETE FROM tc_tool.action WHERE reviewId = ". $post['reviewId'];
    
    	if (!mysql_query($query, $connection))
    	{
    		echo "Query failed: $query<br />" . mysql_error();
    	}
    
    	$rowNum = 1;
    	while (isset($_POST["action_action_" .$rowNum])) {
    
    
    		$query = "INSERT INTO tc_tool.action
    			(
    			reviewId,
    			number,
    			location,
    			responsible,
    			action,
    			status,
    			comment
    			)
    			values 
    			(" . 
    			$post['reviewId'] . ", " . 
    			$rowNum . ", " . 
    			"'" . $_POST["action_location_" .$rowNum] . "', " . 
    			"'" . $_POST["action_responsible_" .$rowNum] . "', " . 
    			"'" . $_POST["action_action_" .$rowNum] . "', " . 
    			"'" . $_POST["action_status_" .$rowNum] . "', " . 
    			"'" . $_POST["action_comment_" .$rowNum] . "'
    				)				
    			";
    
    		if (!mysql_query($query, $connection))
    	{
    		echo "Query failed: $query<br />" . mysql_error();
    	}
    
    
    		$rowNum = $rowNum + 1;
    	}
    
    
    
    
    	if (mysql_affected_rows() === 1) 
    	{
    			echo "MOM Saved... Redirecting..." . "<br />";
    	}
    
    	else 
    	{
    		echo "" . "<br />";
    	}	
    
    	function died($error) 
    	{
    		// Error code here
    		echo "Error, not saving successfully. ";
    		echo "The errors are below.<br /><br />";
    		echo $error."<br /><br />";
    		echo "Please retry.<br /><br />";
    		//var_dump($_POST);
    		die();
    	}
    
    	mysql_close($connection);
    }
    ?>
    

     

    I can post the code from the page that has the button on it but its 1631 lines long. Here is all of the code for the saveMom part of the page that contains the button -

     

    <form action = \"saveMom.php\" method = \"post\" onsubmit = \"return validateForm()\">
    <input type=\"hidden\" id=\"reviewId\" name=\"reviewId\" value=\"" . $id . "\" />
    
    <table width = \"100%\" id = \"momTable\" border = 0 >
    
    <tr class = \"heading\">
    <td ALIGN = \"center\" colspan = \"3\" class = \"heading\"><b>Minutes of Meeting</b></td>
    </tr>
    
    <tr class = \"secondHeading\">
    <td width = \"100%\" class = \"secondHeading\">
    <b>Quality Ranking of Review (1-5)</b>
    </td>
    <td>
    <input type = \"text\" name = \"qualityRankingOfReview\" size = \"1\" value=\"" . $row['qualityRankingOfReview'] . "\" style = \"float:right\"/>
    </td>
    
    <td>
    <img id = \"qualityRankingReviewBtn\" src = \"images/arrowright.png\" align = \"right\" title = \"Click to expand\" onclick = \"hideSection('qualityRankingReview');\"/>
    </td>
    
    </tr>
    
    <tr id = \"qualityRankingReview\" style=\"display:none;\">
    <td colspan = \"3\">
    <p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'><br /><u><b>Email Comments</b>:</u>
    	(To be completed by TC chairperson)<br /><br />
    	1 = Undefined.<br />
    	2 = Document not of sufficient quality to review, missing chapters, clear competence or schedule issue apparent in the review.<br />
        3 = Insufficient participants in the review or insufficient preparation from participants.<br />
        4 = Proper review with some major open issues but in control.<br />
            5 = Proper review with no major open issues.<br /><br />
    </font>
    </p>
    </td>
    
    </tr>
    
    <tr class = \"secondHeading\">
    <td width = \"100%\" class = \"secondHeading\">
    <b>Quality Ranking of Input Document (1-10)</b><br />
    </td>
    <td>
    <input type = \"text\" name = \"inputDocRank\" size = \"1\" readonly=\"readonly\" disabled=\"disabled\" style = \"float:right\"/>
    </td>
    <td>
    <img id = \"qualityRankingDocumentBtn\" src = \"images/arrowright.png\" align = \"right\" title = \"Click to expand\" onclick = \"hideSection('qualityRankingDocument');\"/>
    </td>
    </tr>
    
    <tr id = \"qualityRankingDocument\" style=\"display:none;\">
    <td colspan = \"3\" width = \"100%\"><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'><b>To be completed by TC chairperson using TC OSS RC document checklist.</b></font></p>
    </td>
    </tr>
    	<tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"correctDocTemplate\" size = \"1\""
    	. ($row['correctDocTemplate'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Has the correct document instruction/template been followed?</font></p></td></tr>
    
        <tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"internallyReviewed\" size = \"1\""
    	. ($row['internallyReviewed'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Has the document been internally reviewed?</font></p></td></tr>
    
            <tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"requirementsCovered\" size = \"1\""
    	. ($row['requirementsCovered'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Does the requirements chapter state whether all requirements have been covered, and explain why specific requirements are not covered?</font></p></td></tr>
    
        <tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"correctStorageLibrary\" size = \"1\""
    	. ($row['correctStorageLibrary'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Is the document stored in the correct storage library with the correct status?</font></p></td></tr>
    
    	<tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"reportsDescribed\" size = \"1\"" 
    	. ($row['reportsDescribed'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Have all trouble reports for faults corrected by the system modifications been described? It should be obvious which applications were investigated to find all relevant  trouble reports.</font></p></td></tr>
    
        <tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"changeRequestsIncluded\" size = \"1\""
    	. ($row['changeRequestsIncluded'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Have all approved change requests been included?</font></p></td></tr>
    
        <tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"openIssuesAddressed\" size = \"1\""
    	. ($row['openIssuesAddressed'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Are all open issues addressed?</font></p></td></tr>
        
    	<tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"docAvailable\" size = \"1\""
    	. ($row['docAvailable'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Has the document been available at least 5 working days before the review date?</font></p></td></tr>
    
        <tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"statementProblemChapter\" size = \"1\""
    	. ($row['statementProblemChapter'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Does the Technical Solution chapter describe the solution to the problems described in the Statement of Problem chapter?</font></p></td></tr>
    
        <tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" ><input style=\"float:right;\" type = \"checkbox\" name = \"majorComments\" size = \"1\""
    	. ($row['majorComments'] == 1 ? "checked=\"yes\"" : "") . 
    	"\" onclick = \"updateDocumentQualityRank();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Are there more than 50% major comments?</font></p></td></tr>
    	<tr id = \"qualityRankingDocument\" style=\"display:none;\"><td colspan = \"3\" >
    	<input type = \"text\" name = \"inputDocRank2\" size = \"1\" readonly=\"readonly\" disabled=\"disabled\" style=\"float:right;\" />
    	</tr>
    
    <tr class = \"secondHeading\">
    <td class = \"secondHeading\" colspan = \"2\">
    <input type = \"text\" name = \"result2\" size = \"14\" readonly=\"readonly\" disabled=\"disabled\"/ style=\"float:right\"><b>Review Summary</b>
    </td>
    <td>
    <img id = \"reviewSummaryBtn\" src = \"images/arrowright.png\" align = \"right\" title = \"Click to expand\" onclick = \"hideSection('reviewSummary');\"/>
    </td>
    
    <tr id = \"reviewSummary\" style=\"display:none;\">
    	<td colspan = \"3\"><select name = \"result\" style = \"float:right;\" value=\"" . $row['result'] . "\" onchange=\"updateReviewSummary(this.value, true);\">
    		<option value = '' SELECTED>-Please Select-</option>
    		<option value = \"Approved\">Approved</option>
    		<option value = \"Not Approved\">Not Approved</option>
    		<option value = \"Cancelled\">Cancelled</option>
    		</select><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Result</font></p></td>
    </tr>
    
    <tr id = \"reviewSummary\" style=\"display:none;\">
    	<td colspan = \"3\"><input type = \"text\" name = \"numberOfMajorComments\" size = \"1\" style = \"float:right;\" value=\"" . $row['numberOfMajorComments'] . "\" /><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>No. of Major Comments</font></p></td>
    </tr>
    
    
    <tr id = \"reviewSummary\" style=\"display:none;\">
    	<td colspan = \"3\"><input type = \"text\" name = \"numberOfMinorComments\" size = \"1\" style = \"float:right;\" value=\"" . $row['numberOfMinorComments'] . "\" /><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>No. of Minor Comments</font></p></td>
    </tr>
    
    <tr id = \"reviewSummary_nextReviewForum\" style=\"display:none;\">
    	<td colspan = \"3\">
    	<select name = \"nextReviewForum\" style = \"float:right;\" value=\"" . $row['nextReviewForum'] . "\">
    			<option value = '' SELECTED>-Please Select-</option>
    	</select><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Next Review Forum</font></p>
    		</td>		
    
    </tr>
    
    <tr id = \"reviewSummary_reasonForCancellation\" style=\"display:none;\" >
    	<td colspan = \"3\"><select name = \"reasonForCancellation\" style = \"float:right;\"  value=\"" . $row['reasonForCancellation'] . "\" onchange=\"updateOtherCommentVisibility();\">
    			<option value = '' SELECTED>-Please Select-</option>
    			<option value = 'Insufficient Participants' >Insufficient Participants</option>
    			<option value = 'Requirements Issue' >Requirements Issue</option>
    			<option value = 'Missed Impacts Issue' >Missed Impacts Issue</option>
    			<option value = 'Workshop Required' >Workshop Required</option>
    			<option value = 'Other' >Other...</option>
    		</select><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Reason for cancellation</font></p>
    		</td>		
    
    </tr>
    
    <tr id = \"reviewSummary_reasonForReReview\" style=\"display:none;\">
    	<td colspan = \"3\"><select name = \"reasonForReReview\" style = \"float:right;\"  value=\"" . $row['reasonForReReview'] . "\" onchange=\"updateOtherCommentVisibility();\">
    			<option value = '' SELECTED>-Please Select-</option>
    			<option value = 'Insufficient Participants' >Insufficient Participants</option>
    			<option value = 'Requirements Issue' >Requirements Issue</option>
    			<option value = 'Missed Impacts Issue' >Missed Impacts Issue</option>
    			<option value = 'Scope Issue' >Scope Issue</option>
    			<option value = 'Workshop Required' >Workshop Required</option>
    			<option value = 'Other' >Other...</option>
    		</select><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Reason for re-review</p></font>
    		</td>		
    
    </tr>
    
    <tr id = \"reviewSummary_otherComment\" style=\"display:none;\">
    <td colspan = \"3\"><input type = \"text\" name = \"otherComments\" value=\"" . $row['otherComments'] . "\"  size = \"30\" style = \"float:right;\"/>
    Please Specify</td>
    </tr>
    
    <tr colspan = \"3\" class = \"secondHeading\">
    	<td class = \"secondHeading\" colspan = \"2\"><input type = \"text\" name = \"date2\" size = \"20\" readonly=\"readonly\" disabled=\"disabled\"/ style=\"float:right\"><b>Particulars of Meeting</b></td>
    		<td>
    <img id = \"particularsOfMeetingBtn\" src = \"images/arrowright.png\" align = \"right\" title = \"Click to expand\" onclick = \"hideSection('particularsOfMeeting');\"/>
    </td>
    </tr>
    
    <tr id = \"particularsOfMeeting\" style=\"display:none;\">
    	<td colspan = \"3\" >
    	";
    
    	if ($row['date'] != null && $row['date'] != "") {
    		$date = date("d-m-Y", strtotime($row['date']));
    	} else {
    		$date = "";
    	}
    	echo "
    	<input type = \"text\" name = \"date\" id = \"date\" size = \"20\" readonly=\"readonly\" class=\"tcal\" style=\"float:right\" value=\"" . $date . "\" onblur = \"updateTitleDate();\"/><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Date</font></p></td>
    
    </tr>
    
    <tr id = \"particularsOfMeeting\" style=\"display:none;\">
    	<td colspan = \"3\"><select name = \"time\" style = \"float:right;\" value=\"" . $row['time'] . "\" >
    		<option value = '' SELECTED>-Please Select a Time-</option>
    		<option value = \"0800\">08:00</option>
    		<option value = \"0900\">09:00</option>
    		<option value = \"1000\">10:00</option>
    		<option value = \"1100\">11:00</option>
    		<option value = \"1200\">12:00</option>
    		<option value = \"1300\">13:00</option>
    		<option value = \"1400\">14:00</option>
    		<option value = \"1500\">15:00</option>
    		<option value = \"1600\">16:00</option>
    		<option value = \"1700\">17:00</option>
    		<option value = \"1800\">18:00</option>
    		<option value = \"1900\">19:00</option>
    		</select><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Time</font></p></td>
    </tr>
    
    <tr id = \"particularsOfMeeting\" style=\"display:none;\">
    	<td colspan = \"3\"><select name = \"venue\" style = \"float:right;\" value=\"" . $row['venue'] . "\">
    		<option value = '' SELECTED>-Please Select-</option>
    		<option value = \"Lough Mask\">Lough Mask</option>
    		<option value = \"Lough Neagh\">Lough Neagh</option>
    		<option value = \"Lough Sheelin\">Lough Sheelin</option>
    		<option value = \"Lough Allen\">Lough Allen</option>
    		<option value = \"Shaw\">Shaw</option>
    		<option value = \"Beckett\">Beckett</option>
    		<option value = \"Yeats\">Yeats</option>
    		<option value = \"Heaney\">Heaney</option>
    		<option value = \"Tyndall\">Tyndall</option>
    		<option value = \"Lilliput\">Lilliput</option>
    		<option value = \"Lough Ree\">Lough Ree</option>
    		k<option value = \"Goldsmith\">Goldsmith</option>
    		<option value = \"Kelvin Meeting Room\">Kelvin Meeting Room</option>
    		<option value = \"Blyry\">Blyry</option>
    		<option value = \"Lough Conn\">Lough Conn</option>
    		<option value = \"Lough Corrib\">Lough Corrib</option>
    		<option value = \"Lough Derg\">Lough Derg</option>
    		<option value = \"Lough Owell\">Lough Owell</option>
    		<option value = \"OSS Demo Room\">OSS Demo Room</option>
    		<option value = \"Synge Conference Room\">Synge Conference Room</option>
    		<option value = \"Annexe Conference Room\">Annexe Conference Room</option>
    		<option value = \"Lars Magnus\">Lars Magnus</option>
    		<option value - \"Office\">Office</option>
    		</select><p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Venue</font></p></td>
    
    </tr>
    
    <tr id = \"particularsOfMeeting\" style=\"display:none;\">
    	<td colspan = \"3\" >
    	<textarea name = \"attendees\" cols = \"25\" rows = \"8\" style=\"float:right\"  type = \"text\" value=\"" . $row["attendees"] . "\">" . $row["attendees"] . "</textarea>
    	<p style = \"font-family:Arial, Helvetica, sans-serif\"><font size = '2'>Attendees</font></p>
    	</td>
    </tr>
    
    <tr colspan = \"3\" class = \"secondHeading\">
    	<td class = \"secondHeading\" colspan = \"2\"><b>Remarks</b></td>
    		<td>
    <img id = \"remarksBtn\" src = \"images/arrowright.png\" align = \"right\" title = \"Click to expand\" onclick = \"hideSection('remarks');\"/>
    </td>
    </tr>	
    
    <tr id = \"remarks\" style=\"display:none;\">
    	<td colspan = \"3\" >
    		<table id = \"remarksTable\">
    		<tr>
    		<th>No. <img src = \"images/sortArrow.png\" onclick=\"sortRemarksColumn('number');\" width=\"14\" height=\"6\"></th>
    		<th>Location (Chapter, page) <img src = \"images/sortArrow.png\" onclick=\"sortRemarksColumn('location');\" width=\"14\" height=\"6\"></th>
    		<th>Severity <img src = \"images/sortArrow.png\" onclick=\"sortRemarksColumn('severity');\" width=\"14\" height=\"6\"></th>
    		<th>Responsible <img src = \"images/sortArrow.png\" onclick=\"sortRemarksColumn('responsible');\" width=\"14\" height=\"6\"></th>
    		<th>Remark <img src = \"images/sortArrow.png\" onclick=\"sortRemarksColumn('remark');\" width=\"14\" height=\"6\"></th>
    		<th>Status <img src = \"images/sortArrow.png\" onclick=\"sortRemarksColumn('status');\" width=\"14\" height=\"6\"></th>
    		<th>Comment <img src = \"images/sortArrow.png\" onclick=\"sortRemarksColumn('comment');\" width=\"14\" height=\"6\"></th>
    		<th>Add Row <img src=\"images/addRow.png\" onclick=\"addNewRemarksRow();\"></th>
    		</tr>
    
    		";
    
    	$sql = "
    	SELECT *						
    	FROM tc_tool.remark
    	WHERE
    	(
    	reviewId = '$formattedID'
    	)
    	ORDER BY number ASC
    	";
    
    	$remarkData = mysql_query($sql) or die(mysql_error()."<br>-----------<br>$sql");
    	$num = mysql_num_rows($remarkData); // <-- This line is counting the number of rows returned by the query
    
    	while($remarkRow = mysql_fetch_assoc($remarkData))
    	{	
    
    		echo "<tr >
    		<td>" . $remarkRow["number"] . "</td>
    		<td><input name = \"remark_location_"  . $remarkRow["number"] . "\" id = \"remark_location_"  . $remarkRow["number"] . "\"  type = \"text\" value = \"" . $remarkRow["location"] . "\"></td>
    
    		<td><select name = \"remark_severity_" . $remarkRow["number"] . "\" id = \"remark_severity_" . $remarkRow["number"] . "\">
    		<option value = \"-Please Select-\">-Please Select-</option>
    		<option value = \"Minor\" " . ($remarkRow["severity"] == "Minor" ? "SELECTED" : "") . ">Minor</option>
    		<option value = \"Major\" " . ($remarkRow["severity"] == "Major" ? "SELECTED" : "") . ">Major</option>
    		</td>
    
    		<td><input name = \"remark_responsible_"  . $remarkRow["number"] . "\" id = \"remark_responsible_"  . $remarkRow["number"] . "\" type = \"text\" value = \"" . $remarkRow["responsible"] . "\"></td>
    
    
    		<td><textarea name = \"remark_remark_"  . $remarkRow["number"] . "\" cols = \"25\" rows = \"8\" id = \"remark_remark_"  . $remarkRow["number"] . "\" type = \"text\" value = \"" . $remarkRow["comment"] . "\">" . $remarkRow["remark"] . "</textarea></td>
    
    		<td><select name = \"remark_status_" . $remarkRow["number"] . "\" id = \"remark_status_" . $remarkRow["number"] . "\">
    		<option value = \"-Please Select-\">-Please Select-</option>
    		<option value = \"Acted Upon\" " . ($remarkRow["status"] == "Acted Upon" ? "SELECTED" : "") . ">Acted Upon</option>
    		<option value = \"Not Accepted\" " . ($remarkRow["status"] == "Not Accepted" ? "SELECTED" : "") . ">Not Accepted</option>
    		</td>
    
    		<td><textarea name = \"remark_comment_"  . $remarkRow["number"] . "\" cols = \"25\" rows = \"8\" id = \"remark_comment_"  . $remarkRow["number"] . "\" value = \"" . $remarkRow["comment"] . "\">" . $remarkRow["comment"] . "</textarea></td>
    
    		<td><img title = \"Delete Row\" src = \"images/deleteRow.png\" onclick = \"deleteRemarkRow('remarksRow"  . $remarkRow["number"] .  "');\"></td>
    		</tr>";
    
    	}
    
    		/*
    			=== Old comment box ===
    
    		<td><input name = \"remark_comment_"  . $remarkRow["number"] . "\" id = \"remark_comment_"  . $remarkRow["number"] . "\" value = \"" . $remarkRow["comment"] . "\"></input></td>
    
    		*/
    	//echo " </table><br /><br />";
    
    	echo "
    
    	</table>
    	</td>
    	</tr>
    
    <tr colspan = \"3\" class = \"secondHeading\">
    	<td class = \"secondHeading\" colspan = \"2\"><b>Actions</b></td>
    		<td>
    <img id = \"actionsBtn\" src = \"images/arrowright.png\" align = \"right\" title = \"Click to expand\" onclick = \"hideSection('actions');\"/>
    </td>
    </tr>	
    
    <tr id = \"actions\" style=\"display:none;\">
    	<td colspan = \"3\" >
    		<table id = \"actionsTable\">
    		<tr>
    		<th>No. <img src = \"images/sortArrow.png\" onclick=\"sortActionsColumn('number');\" width=\"14\" height=\"6\"></th>
    		<th>Location <img src = \"images/sortArrow.png\" onclick=\"sortActionsColumn('location');\" width=\"14\" height=\"6\"></th>
    		<th>Responsible <img src = \"images/sortArrow.png\" onclick=\"sortActionsColumn('responsible');\" width=\"14\" height=\"6\"></th>
    		<th>Action <img src = \"images/sortArrow.png\" onclick=\"sortActionsColumn('action');\" width=\"14\" height=\"6\"></th>
    		<th>Status <img src = \"images/sortArrow.png\" onclick=\"sortActionsColumn('status');\" width=\"14\" height=\"6\"></th>
    		<th>Comment <img src = \"images/sortArrow.png\" onclick=\"sortActionsColumn('comment');\" width=\"14\" height=\"6\"></th>
    		<th>Add Row <img src=\"images/addRow.png\" onclick=\"addNewActionRow();\"></th>
    
    		</tr>
    
    		";
    
    	$sql = "
    	SELECT *						
    	FROM tc_tool.action
    	WHERE
    	(
    	reviewId = '$formattedID'
    	)
    	ORDER BY number ASC
    	";
    
    	$actionData = mysql_query($sql) or die(mysql_error()."<br>-----------<br>$sql");
    	$num = mysql_num_rows($actionData); // <-- This line is counting the number of rows returned by the query
    
    	while($actionRow = mysql_fetch_assoc($actionData))
    	{	
    
    		echo "<tr>
    		<td>" . $actionRow["number"] . "</td>
    		<td><input name = \"action_location_"  . $actionRow["number"] . "\" id = \"action_location_" . $actionRow["number"] . "\" type = \"text\" value = \"" . $actionRow["location"] . "\"></td>
    
    		<td><input name = \"action_responsible_"  . $actionRow["number"] . "\" id = \"action_responsible_" . $actionRow["number"] . "\" type = \"text\" value =\"" . $actionRow["responsible"] . "\"></td>
    		<td><input name = \"action_action_"  . $actionRow["number"] . "\" id = \"action_action_" . $actionRow["number"] . "\" type = \"text\" value = \"" . $actionRow["action"] . "\"></td>
    
    		<td><select name = \"action_status_" . $actionRow["number"] . "\" id = \"action_status_" . $actionRow["number"] . "\">
    		<option value = \"-Please Select-\">-Please Select-</option>
    		<option value = \"Open\" " . ($actionRow["status"] == "Open" ? "SELECTED" : "") . ">Open</option>
    		<option value = \"In-Progress\" " . ($actionRow["status"] == "In-Progress" ? "SELECTED" : "") . ">In-Progress</option>
    		<option value = \"Re-Opened\" " . ($actionRow["status"] == "Re-Opened" ? "SELECTED" : "") . ">Re-Opened</option>
    		<option value = \"Resolved\" " . ($actionRow["status"] == "Resolved" ? "SELECTED" : "") . ">Resolved</option>
    		<option value = \"Closed\" " . ($actionRow["status"] == "Closed" ? "SELECTED" : "") . ">Closed</option>
    		</td>
    
    		<td><textarea name = \"action_comment_"  . $actionRow["number"] . "\" id = \"action_comment_"  . $actionRow["number"] . "\" type = \"text\"  cols = \"25\" rows = \"8\" value = \"" . $actionRow["comment"] . "\">" . $actionRow["comment"] . "</textarea></td>
    		<td><img title = \"Delete Row\" src = \"images/deleteRow.png\" onclick = \"deleteActionRow('actionsRow"  . $actionRow["number"] .  "');\"></td>
    		</tr>";
    
    	}
    
    	echo "
    
    	</table>
    	</td>
    </tr>
    
    <tr colspan = \"3\" class = \"secondHeading\">
    <td class = \"secondHeading\" colspan = \"2\"><b>Miscellaneous</b></td>
    <td>
    <img id = \"miscellaneousBtn\" src = \"images/arrowright.png\" align = \"right\" title = \"Click to expand\" onclick = \"hideSection('miscellaneous');\"/>
    </td>
    </tr>	
    <tr id = \"miscellaneous\" style=\"display:none;\">
    
    <td colspan = \"3\" >
    	<p style = \"font-family:Ericsson Capital TT Regular\"><font size = '3'><br /><u>Email Comments:</u></font></p>
    
    	<textarea name = \"emailComments\" type = \"text\" style=\"width:100%;\" rows = \"30\" value = \"" . $row["emailComments"] . "\">" . $row["emailComments"] . "</textarea><br />
    	</td>
    </tr>	
    
    <tr colspan = \"3\">
    	<td>
    		<input type=\"button\" name=\"reset_form\"  class = 'eBtnSubmit' value=\"Clear Fields\" onclick=\"this.form.reset();\">
    		<input type=\"submit\" name=\"save\" class = 'eBtnSubmit' value=\"Save Minutes Of Meeting\" />
    		</form>
    	</td>
    	<td>
    ";
    
    // When this echo is included here it disables the Sign Off button
    // echo " </table><br /><br />";
    
    $impl_exportArray = implode(",", $exportArray);
    
    		echo "
    
    		<form id='exportToExcel' action = \"momExport.php\" method = \"post\">
    		<input type = \"hidden\" name = \"reviewIds\" value=\"".$impl_exportArray."\"/>
    		<input type = \"submit\" value = \"Export to Excel\" class='eBtnSubmit' style='display:inline;' onclick =\"momExport.php\">
    		</form>			
    	</td>
    
    	<td>
    		<input type = \"text\" name = \"signOff\" size = \"24\" align = \"right\" value = \"" . $row['signOff'] . "\"/>  <input type=\"submit\" name=\"save\"  class = 'eBtnSubmit' value=\"Sign off\" align = \"right\" />
    	</td> 
    	</tr>
    
    </p>
    </div>
    ";
    
    }
    echo " </table><br /><br />";
    

×
×
  • 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.