Matt Ridge Posted November 9, 2011 Share Posted November 9, 2011 I have an if (!empty criteria that is not showing up. My luck I probably just have put it in the wrong place, but I'm not sure. I need some help because this is the final point and my brain is fried. This is the code that is having the issue: // We know both $ncmrsr AND $ncmrsc are blank if (!empty($row['ncmrsr']) && !empty($row['ncmrsc'])) { echo 'Show Text!.<br />';} All this is suppose to do is to "Show Text", nothing fancy, once it shows, I'll change what it says... The script doesn't fail, but it doesn't post. Can someone tell me why this isn't showing up and what I need to do to fix it? It would be so much better if this showed an error, but it doesn't, so I have to ask for help. Thanks in advance. Before you ask, yes the fields are in the database. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>PDI NCMR - View</title> <link rel="stylesheet" type="text/css" href="../CSS/admin.css" /> </head> <body> <div id="logo"> <img src="../images/PDI_Logo_2.1.gif" alt="PDI Logo" /> </div> <?php require_once('../connectvars.php'); // Connect to the database $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME); // Grab the profile data from the database if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } $data = mysqli_query($dbc, $query); if (mysqli_num_rows($data) == 1) { // The user row was found so display the user data $row = mysqli_fetch_array($data); echo'<h3 id="NCMR2">Non-Conforming Materials Report (NCMR: ' . $row['NCMR_ID'] . ')</h3>'; echo '<form id="all">'; echo '<fieldset>'; if (!empty($row['Added_By'])) { echo '<div id="ab"><tr><td><span class="b">Added By: </span></td><td>' . $row['Added_By'] . '</td></tr></div>';} if (!empty($row['Added_By_Date'])) { echo '<div id="abd"><tr><td><span class="b">On: </span></td><td>' . $row['Added_By_Date'] . '</td></tr></div>';} echo '<div id="box">'; echo '<div id="box1">'; if (!empty($row['Nexx_Part'])) { echo '<div id="np"><tr><td><span class="b">Nexx Part: </span></td><td>' . $row['Nexx_Part'] . '</td></tr></div>';} if (!empty($row['Nexx_Rev'])) { echo '<div id="nr"><tr><td><span class="b">Nexx Rev: </span></td><td>' . $row['Nexx_Rev'] . '</td></tr></div>';} if (!empty($row['Nexx_Part_Description'])) { echo '<div id="npd"><tr><td><span class="b">Nexx Part Description: </span></td><td>' . $row['Nexx_Part_Description'] . '</td></tr></div>';} if (!empty($row['NCMR_Qty'])) { echo '<div id="ncqt"><tr><td><span class="b">NCMR Qty: </span></td><td>' . $row['NCMR_Qty'] . '</td></tr></div>';} echo '<div id ="JSI">'; if (!empty($row['JO'])) { echo '<div id="JO"><tr><td><span class="b">JO: </span></td><td><br />' . $row['JO'] . '</td></tr></div>';} if (!empty($row['SN'])) { echo '<div id="SN"><tr><td><span class="b">SN: </span></td><td><br />' . $row['SN'] . '</td></tr></div>';} if (!empty($row['INV'])) { echo '<div id="INV"><tr><td><span class="b">INV: </span></td><td><br />' . $row['INV'] . '</td></tr></div>';} echo '</div>'; echo '<div id="box2">'; if (!empty($row['Nexx_Inventory_On_Hand'])) { echo '<div id="nioh"><tr><td><span class="b">Nexx Inventory On Hand: </span></td><td>' . $row['Nexx_Inventory_On_Hand'] . '</td></tr></div>';} if (!empty($row['Nexx_Inventory_Chk'])) { echo '<div id="nic"><tr><td><span class="b">Nexx Inventory Chk: </span></td><td>' . $row['Nexx_Inventory_Chk'] . '</td></tr></div>';} if (!empty($row['Supplier_Name'])) { echo '<div id="sun"><tr><td><span class="b">Supplier Name: </span></td><td>' . $row['Supplier_Name'] . '</td></tr></div>';} if (!empty($row['Supplier_Number'])) { echo '<div id="supn"><tr><td><span class="b">Supplier Number: </span></td><td>' . $row['Supplier_Number'] . '</td></tr></div>';} if (!empty($row['Manufacturer_Part_Number'])) { echo '<div id="mpn"><tr><td><span class="b">Manufacturer Part Number: </span></td><td>' . $row['Manufacturer_Part_Number'] . '</td></tr></div>';} if (!empty($row['Manufacturer_Serial_Number'])) { echo '<div id="msn"><tr><td><span class="b">Manufacturer Serial Number: </span></td><td>' . $row['Manufacturer_Serial_Number'] . '</td></tr></div>';} if (!empty($row['NCMR_ID'])) { echo '<div id="cnno"><tr><td><span class="b">NCMR ID: </span></td><td>' . $row['NCMR_ID'] . '</td></tr></div>';} echo '</div>'; echo '<div id="box3">'; if (!empty($row['Nonconformity'])) { echo '<div id="non"><tr><td><span class="b">Nonconformity: </span></td><td><br />' . $row['Nonconformity'] . '</td></tr></div>';} if (!empty($row['Disposition'])) { echo '<div id="dis"><tr><td><span class="b">Disposition: </span></td><td><br />' . $row['Disposition'] . '</td></tr></div>';} if (!empty($row['Comments'])) { echo '<div id="comm"><tr><td><span class="b">Comments: </span></td><td><br />' . $row['Comments'] . '</td></tr></div>';} if (!empty($row['CommentsAdditional_Details'])) { echo '<div id="comma"><tr><td><span class="b">Comments and/or Additional Details: </span></td><td><br />' . $row['CommentsAdditional_Details'] . '</td></tr></div>';} echo '<div id="poinfo">'; if (!empty($row['PO'])) { echo '<div id="po"><tr><td><span class="b">PO: </span></td><td>' . $row['PO'] . '</td></tr></div>';} if (!empty($row['PO_Date'])) { echo '<div id="pod"><tr><td><span class="b">PO Date: </span></td><td>' . $row['PO_Date'] . '</td></tr></div>';} if (!empty($row['Date_Received'])) { echo '<div id="dri"><tr><td><span class="b">Date Received: </span></td><td>' . $row['Date_Received'] . '</td></tr></div>';} echo '</div>'; echo '</div>'; echo '</fieldset>'; echo '</form>'; echo '</div>'; // We know both $ncmrsr AND $ncmrsc are blank if (!empty($row['ncmrsr']) && !empty($row['ncmrsc'])) { echo 'Show Text!.<br />';} } // End of check for a single row of user results else { echo '<p class="error">Please contact the web administrator, there seems to be an error!</p>'; } mysqli_close($dbc); ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 9, 2011 Share Posted November 9, 2011 This seems to be self-contradicting. You imply that both are known to be empty, but want to echo something if both are not empty? Can you clarify that a bit? // We know both $ncmrsr AND $ncmrsc are blank if (!empty($row['ncmrsr']) && !empty($row['ncmrsc'])) { echo 'Show Text!.<br />';} Quote Link to comment Share on other sites More sharing options...
RaythMistwalker Posted November 9, 2011 Share Posted November 9, 2011 if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } You aren't setting $id anywhere above these lines as far as i can see so your always relying on $_GET['id'] being set as well Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 10, 2011 Author Share Posted November 10, 2011 This seems to be self-contradicting. You imply that both are known to be empty, but want to echo something if both are not empty? Can you clarify that a bit? // We know both $ncmrsr AND $ncmrsc are blank if (!empty($row['ncmrsr']) && !empty($row['ncmrsc'])) { echo 'Show Text!.<br />';} Sorry for the delay in response. What I am looking for is to look at the database and if these two fields are empty post a comment. Otherwise show the fields. Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 10, 2011 Author Share Posted November 10, 2011 <?php if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } ?> You aren't setting $id anywhere above these lines as far as i can see so your always relying on $_GET['id'] being set as well Up near the top, line 20 - 26 // Grab the profile data from the database if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 10, 2011 Share Posted November 10, 2011 That doesn't assign a value to $id unless $_GET['id'] is set. And using $_GET['id'] in a database query without validating/sanitizing it leaves you open to SQL injection. Quote Link to comment Share on other sites More sharing options...
AyKay47 Posted November 10, 2011 Share Posted November 10, 2011 the output is not showing because your conditions have not been met, plain and simple. If you know that both are blank, and want to show output upon both fields containing data, you obviously will not receive any output. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 10, 2011 Share Posted November 10, 2011 This seems to be self-contradicting. You imply that both are known to be empty, but want to echo something if both are not empty? Can you clarify that a bit? // We know both $ncmrsr AND $ncmrsc are blank if (!empty($row['ncmrsr']) && !empty($row['ncmrsc'])) { echo 'Show Text!.<br />';} Sorry for the delay in response. What I am looking for is to look at the database and if these two fields are empty post a comment. Otherwise show the fields. In that case, the logic should be like this: [code=php:0]// We know both $ncmrsr AND $ncmrsc are blank $row['ncmrsr'] = trim($row['ncmrsr']); $row['ncmrsc'] = trim($row['ncmrsc']); if (!empty($row['ncmrsr']) && !empty($row['ncmrsc'])) { // code to add comment would go here. } else { // echo the two fields } Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 10, 2011 Author Share Posted November 10, 2011 This seems to be self-contradicting. You imply that both are known to be empty, but want to echo something if both are not empty? Can you clarify that a bit? // We know both $ncmrsr AND $ncmrsc are blank if (!empty($row['ncmrsr']) && !empty($row['ncmrsc'])) { echo 'Show Text!.<br />';} Sorry for the delay in response. What I am looking for is to look at the database and if these two fields are empty post a comment. Otherwise show the fields. In that case, the logic should be like this: [code=php:0]// We know both $ncmrsr AND $ncmrsc are blank $row['ncmrsr'] = trim($row['ncmrsr']); $row['ncmrsc'] = trim($row['ncmrsc']); if (!empty($row['ncmrsr']) && !empty($row['ncmrsc'])) { // code to add comment would go here. } else { // echo the two fields } Thanks, this is greatly appreciated. I do have a question though, you saw my original code, this script can just be inserted right where the old one was or was that in it's correct place? I hate to ask, because I am still pretty new to PHP/SQL and everything in between, and I have cobbled this script together. I am going to be working on other aspects of it to reinforce the ability of keeping the script from being hacked, etc... but I just don't want to spend a good chunk of the day realizing that it was placed in the wrong place all this time... I'm sure you know what I mean. Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 10, 2011 Author Share Posted November 10, 2011 That doesn't assign a value to $id unless $_GET['id'] is set. And using $_GET['id'] in a database query without validating/sanitizing it leaves you open to SQL injection. Meaning? Sorry if I sound new, I am I picked up a PHP/SQL book about a month ago, and what you see is part of the culmination of what I have learned in that time... which is enough to make me dangerous as you can tell. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 10, 2011 Share Posted November 10, 2011 I need to make an edit to the code above . . . I neglected to remove the ! NOT from the empty functions. This line should read: if (empty($row['ncmrsr']) && empty($row['ncmrsc'])) { That doesn't assign a value to $id unless $_GET['id'] is set. And using $_GET['id'] in a database query without validating/sanitizing it leaves you open to SQL injection. Meaning? Sorry if I sound new, I am I picked up a PHP/SQL book about a month ago, and what you see is part of the culmination of what I have learned in that time... which is enough to make me dangerous as you can tell. Which part do you want clarified? The variable assignment, or sanitization? Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 10, 2011 Author Share Posted November 10, 2011 I need to make an edit to the code above . . . I neglected to remove the ! NOT from the empty functions. This line should read: if (empty($row['ncmrsr']) && empty($row['ncmrsc'])) { That doesn't assign a value to $id unless $_GET['id'] is set. And using $_GET['id'] in a database query without validating/sanitizing it leaves you open to SQL injection. Meaning? Sorry if I sound new, I am I picked up a PHP/SQL book about a month ago, and what you see is part of the culmination of what I have learned in that time... which is enough to make me dangerous as you can tell. Which part do you want clarified? The variable assignment, or sanitization? Both actually. Quote Link to comment Share on other sites More sharing options...
RaythMistwalker Posted November 11, 2011 Share Posted November 11, 2011 for sanitization use mysql_real_escape_string() so in your case is mysql_real_escape_string($_GET['id']); What I was saying before is that in the first if statement: if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } You are asking it to use $id instead of $_GET['id'] but this query wont work since you haven't actually assigned $id anywhere first. Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 11, 2011 Author Share Posted November 11, 2011 for sanitization use mysql_real_escape_string() so in your case is mysql_real_escape_string($_GET['id']); What I was saying before is that in the first if statement: if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } You are asking it to use $id instead of $_GET['id'] but this query wont work since you haven't actually assigned $id anywhere first. I hate to ask this, but if that's true how is my page working at all by showing the correct NCMR number and data? There are two reports in the database with two separate numbers...this is the second one, not the first in line. Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 11, 2011 Author Share Posted November 11, 2011 I got it working, but now my CSS isn't... I'll ask this in another area, thanks for the help! Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 11, 2011 Author Share Posted November 11, 2011 Ok, I've taken the question here and expanded on it. I've come up with a problem though. There is an error: Parse error: syntax error, unexpected '!', expecting T_STRING or T_VARIABLE or '$' in /home/pawz/public_html/kaboomlabs.com/PDI/test.php on line 33 Here is the link Now I would love to actually understand this error, because what I am trying to say is that if the fields in the form below aren't empty, submit it to the database. What I am trying to do is this: IF database fields are empty, show the input form with the ability to submit the document. IF they are filled with data, don't show the form, but show the fields. Now the problem is I already have a form in there... so how am I going to distinguish between the two? I thought I solved it, but I am at a loss. If someone can help it would be greatly appreciated. If you have any questions please ask. <?php require_once('connectvars.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>PDI Non-Conforming Materials Report</title> <link rel="stylesheet" type="text/css" href="CSS/view.css" /> </head> <body> <?php //Post Data if (isset($_POST['submit'])) { $ncmrsr = $_POST['ncmrsr']; $ncmrsc = $_POST['ncmrsc']; $output_form = 'no'; if (empty($ncmrsr) || empty($ncmrsc)) { // We know at least one of the input fields is blank echo 'Would you like to leave a comment?.<br />'; $output_form = 'yes'; } } if (!empty($ncmrsr) && empty(!$ncmrsc)) { $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('Error connecting to MySQL server.'); // Grab the profile data from the database if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } $data = mysqli_query($dbc, $query); if (mysqli_num_rows($data) == 1) { // The user row was found so display the user data $row = mysqli_fetch_array($data); $query = "INSERT INTO ncmr (ncmrsr, ncmrsc) VALUES ('$ncmrsr', '$ncmrsc')"; mysqli_query($dbc, $query) or die ('Data not inserted.'); } if ($output_form == 'yes') { echo '<form id="all">'; echo '<fieldset>'; if (!empty($row['Added_By'])) { echo '<div id="ab"><tr><td><span class="b">Added By: </span></td><td>' . $row['Added_By'] . '</td></tr></div>';} } ?> <form id='all'> <fieldset> <div id ="box4"> <label>Disposition: (Initiator)</label><br /> <textarea name="ncmrsr" rows="3" cols="85" ></textarea><br /> <label>Comments:</label><br /> <textarea name="ncmrsc" rows="3" cols="85" ></textarea><br /> </div> <div id="button"> <input type="submit" value="submit" name="submit" /> </div> </fieldset> </form> </body> </html> <?php echo '</fieldset>'; echo '</form>'; } ?> Quote Link to comment Share on other sites More sharing options...
requinix Posted November 11, 2011 Share Posted November 11, 2011 The error message means that PHP found a ! where it was expecting to find a string or a variable. It's a syntax error. There's an error with the syntax. Without counting lines I bet it's referring to: empty(!$ncmrsc) Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 11, 2011 Author Share Posted November 11, 2011 The error message means that PHP found a ! where it was expecting to find a string or a variable. It's a syntax error. There's an error with the syntax. Without counting lines I bet it's referring to: empty(!$ncmrsc) That is where the error is, but it needs to be there, it needs to say if the fields are full show what they say. Quote Link to comment Share on other sites More sharing options...
requinix Posted November 11, 2011 Share Posted November 11, 2011 That is where the error is, but it needs to be there, it needs to say if the fields are full show what they say. You're missing what I'm saying. It's spelled wrong. You have the right symbols in the wrong order. Sigh. !empty($ncmrsc) Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 12, 2011 Author Share Posted November 12, 2011 That is where the error is, but it needs to be there, it needs to say if the fields are full show what they say. You're missing what I'm saying. It's spelled wrong. You have the right symbols in the wrong order. Sigh. !empty($ncmrsc) Whoops, sorry... I'm still getting the formatting down it seems. my bad I glanced over what you wrote and didn't understand what you were saying originally. Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 13, 2011 Author Share Posted November 13, 2011 ok, code fixed where you suggested it, and still a blank page. kaboomlabs.com/PDI/test.php <?php require_once('connectvars.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>PDI Non-Conforming Materials Report</title> <link rel="stylesheet" type="text/css" href="CSS/view.css" /> </head> <body> <?php //Post Data if (isset($_POST['submit'])) { $ncmrsr = $_POST['ncmrsr']; $ncmrsc = $_POST['ncmrsc']; $output_form = 'no'; if (empty($ncmrsr) || empty($ncmrsc)) { // We know at least one of the input fields is blank echo 'Would you like to leave a comment?.<br />'; $output_form = 'yes'; } } if (!empty($ncmrsr) && !empty($ncmrsc)) { $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) or die('Error connecting to MySQL server.'); // Grab the profile data from the database if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } $data = mysqli_query($dbc, $query); if (mysqli_num_rows($data) == 1) { // The user row was found so display the user data $row = mysqli_fetch_array($data); $query = "INSERT INTO ncmr (ncmrsr, ncmrsc) VALUES ('$ncmrsr', '$ncmrsc')"; mysqli_query($dbc, $query) or die ('Data not inserted.'); } if ($output_form == 'yes') { echo '<form id="all">'; echo '<fieldset>'; if (!empty($row['Added_By'])) { echo '<div id="ab"><tr><td><span class="b">Added By: </span></td><td>' . $row['Added_By'] . '</td></tr></div>';} } ?> <form id='all'> <fieldset> <div id ="box4"> <label>Disposition: (Initiator)</label><br /> <textarea name="ncmrsr" rows="3" cols="85" ></textarea><br /> <label>Comments:</label><br /> <textarea name="ncmrsc" rows="3" cols="85" ></textarea><br /> </div> <div id="button"> <input type="submit" value="submit" name="submit" /> </div> </fieldset> </form> </body> </html> <?php echo '</fieldset>'; echo '</form>'; } ?> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted November 13, 2011 Share Posted November 13, 2011 You're getting output. If you View ---> Source you can see that the markup before the opening <?php tag is sent. You're getting nothing further because everything else that would generate output is inside this conditional: if (!empty($ncmrsr) && !empty($ncmrsc)) {, which will never evaluate to true before the form is submitted. Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 13, 2011 Author Share Posted November 13, 2011 You're getting output. If you View ---> Source you can see that the markup before the opening <?php tag is sent. You're getting nothing further because everything else that would generate output is inside this conditional: if (!empty($ncmrsr) && !empty($ncmrsc)) {, which will never evaluate to true before the form is submitted. I hate sounding like an idiot, but how do I fix that? I took the if else script I thought and made it so that if empty show html form, otherwise show data. Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 15, 2011 Author Share Posted November 15, 2011 for sanitization use mysql_real_escape_string() so in your case is mysql_real_escape_string($_GET['id']); What I was saying before is that in the first if statement: if (!isset($_GET['id'])) { $query = "SELECT * FROM ncmr WHERE id = '$id'"; } else { $query = "SELECT * FROM ncmr WHERE id = '" . $_GET['id'] . "'"; } You are asking it to use $id instead of $_GET['id'] but this query wont work since you haven't actually assigned $id anywhere first. Sorry, I finally realized what you are saying, long week already, wife was in surgery last night. That being said, the ID is being pushed from another page, and this page is going to be using that information to go forward. Does that help you understand where the ID is coming from? Quote Link to comment Share on other sites More sharing options...
Matt Ridge Posted November 15, 2011 Author Share Posted November 15, 2011 Ok, decided to tweak it a bit, and still no go, I get CSS to show up now, but not the script. I think I'm doing it right... kaboomlabs.com/PDI/test.php <?php require_once('connectvars.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>PDI Non-Conforming Materials Report</title> <link rel="stylesheet" type="text/css" href="CSS/view.css" /> </head> <body> </body> </html> <?php echo '<div id="box4">'; // We know both $ncmrsr AND $ncmrsc are blank $row['ncmrsr'] = trim($row['ncmrsr']); $row['ncmrsc'] = trim($row['ncmrsc']); if (empty($row['ncmrsr']) && empty($row['ncmrsc'])) { // code to add comment would go here. echo '<div id="ncmrsr"><tr><td><span class="b">NCMR Supplier Response: </span></td><textarea name="CommentsAdditional_Details" rows="3" cols="85" ></textarea></tr></div><br />';} else { // echo the two fields if (!empty($row['ncmrsr'])) { echo '<div id="ncmrsr"><tr><td><span class="b">NCMR Supplier Response: </span></td><td>' . $row['ncmrsr'] . '</td></tr></div>';} if (!empty($row['ncmrsc'])) { echo '<div id="ncmrsc"><tr><td><span class="b">NCMR Supplier Comment: </span></td><td>' . $row['ncmrsc'] . '</td></tr></div>';} echo '</div>'; echo '</div>'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.