Sign Up

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

Have an account? Sign In

Have an account? Sign In Now

Sign In

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

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

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

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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

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

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

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

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

Mobile menu

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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:09:46+00:00 2026-05-26T20:09:46+00:00

Here is my code, I have been attempting to find a way to do

  • 0

Here is my code, I have been attempting to find a way to do this.

The point of the code is to do this:

Check database, see if field is filled, if not post form. Once form is filled, submit data to database, then reload page to go to step 2.

Else if field is full show data in database, and bypass the first part.

    <?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 '<form id="all">';
echo '<fieldset>';
echo '<div id="box4-1">';
// 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"><span class="b">NCMR Supplier Response:<br /></span><textarea name="ncmrsr" rows="6" cols="85">"N/A"</textarea></div><br />';
        echo '<br />';
        echo '<div id="ncmrsc"><span class="b">NCMR Supplier Comment:<br /></span><textarea name="ncmrsr" rows="6" cols="85" ></textarea></div><br />';
        }



else {
// echo the two fields
                if (!empty($row['ncmrsr'])) {
                    echo '<div id="ncmrsr"><span class="b">NCMR Supplier Response:<br /></span>' . $row['ncmrsr'] . '</div>';}
                if (!empty($row['ncmrsc'])) {
                    echo '<div id="ncmrsc"><span class="b">NCMR Supplier Comment:<br /></span>' . $row['ncmrsc'] . '</div>';}
                    echo '</div>';
echo '</div>';
echo '</fieldset>';
echo '</form>';

}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:09:46+00:00Added an answer on May 26, 2026 at 8:09 pm

    so first of all you end your html tag before you echo any dynamic fields. Second you always generate the form no matter what the data says. Third you echo <tr> and <td> tags without a containing table. Fourth you only end the form and div tags if there is no data in the $row variable. So there is a lot going on thats wrong.

    <?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
    
    
    
    // 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 '<form id="all" method="post" action="pagetosaveformtoDB.php">';
            echo '<fieldset>';
            echo '<div id="box4-1">';
            echo '<div id="ncmrsr"><span class="b">NCMR Supplier Response:<br /></span><textarea name="ncmrsr" rows="6" cols="85">"N/A"</textarea></div><br />';
            echo '<div id="ncmrsc"><span class="b">NCMR Supplier Comment:<br /></span><textarea name="ncmrsr" rows="6" cols="85" ></textarea></div><br />
            <input name="submit" type="submit" value="submit" />';
            echo '</div></fieldset></form>';
            }
    
    else {
    // echo the two fields
           echo '<div id="box4-1">';
           if (!empty($row['ncmrsr'])) {
              echo '<div id="ncmrsr"><span class="b">NCMR Supplier Response:<br /></span>' . $row['ncmrsr'] . '</div>';}
           if (!empty($row['ncmrsc'])) {
              echo '<div id="ncmrsc"><span class="b">NCMR Supplier Comment:<br /></span>' . $row['ncmrsc'] . '</div>';}
               echo '</div>';
    
    }
    ?>
    </body> 
    </html>
    

    Also I am not sure what connectvars is doing and if thats where the $row variable is coming from so I would def more information if that doesnt fix it.

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

Sidebar

Related Questions

Hi I have been working on this code today after attempting some of the
I have this code here: var infiltrationResult; while(thisOption) { var trNode = document.createElement('tr'); var
I have this code here, which is intended to allow any type of arguments:
I have this code here, {foreach from=$cart.cartItems item=item name=cart} <div id=cart2Produkt> <p>{if $item.Product.ID} <a
I have some code here which works perfectly in firefox but not in chrome
I've been attempting to utilize the plurals resource with Android but have not had
NEWEST EDIT!!! PLEASE... I have been through many permutations of this code. I am
I have been attempting this all morning (VS2K10, OL2K7, .NET 3.5) and my PSTs
enter code here I have a table on SQL server 2005 with bigint primary
Here is the code I have to create an UIAlertView with a textbox. UIAlertView

Explore

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

Footer

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

Insert/edit link

Enter the destination URL

Or link to existing content

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