I have this code that will display whatever that was checked in the checkboxes, but the problem is that this should be an Updating code and not just Adding information, would someone help me with this. Any help will be highly appreciated, thank you very much, it's for my thesis anyway so it's reall important for me.

<?php
define('DB_NAME', 'purchase');
define('DB_USER', 'root');
define('DB_PASSWORD', 'root');
define('DB_HOST', 'localhost');

$connection = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

if (!$connection) {
    die('Could not connect: ' . mysql_error());
}

$result = mysql_select_db(DB_NAME, $connection);

if (!$result) {
    die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
}
$userquery = mysql_query("SELECT * FROM requirements JOIN personal ON requirements.id=personal.id") or die ("The query could not be completed.");

if (mysql_num_rows($userquery) != 1){
die("That id could not be found!" . mysql_error());
}

while($row = mysql_fetch_array($userquery, MYSQL_ASSOC))
{
$firname = $row['firname'];
$famname = $row['famname'];
$strReq = $row['req'];
}
?>
<?php
    if (isset($_POST['update']))
    {
        if (isset($_POST['req']))
        {
            $strReq = implode("<br/>", $_POST['req']);
            $sql = "INSERT INTO requirements". 
            "(req)". 
            "VALUES". 
            "('$strReq')";

            if (!mysql_query($sql)) 
            {
            die('Error: ' . mysql_error());
            }
        }
        else
        {
            $strReq = "";
        }
    }
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Application List</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="search.css" type="text/css" />
    <script src="agentvalidate.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

</head>

<body class="body">
    <header class="mainHeader">
        <img src="img/about.jpg">
        <nav><ul>
            <li><a href="home.html">Home</a></li>
            <li><a href="about-us.html">About Us</a></li>
            <li><a href="project.html">Project</a>
                <ul>
                    <li><a href="purchase-app-property-info.html" class="purchase">Purchase</a></li>
                    <li><a href="house-and-lot.html" class="house&lot">House & Lot</a></li>
                </ul>
            </li>
            <li><a href="contact-us.html">Contact Us</a></li>
        </ul></nav>
    </header>

    <div class="mainContent">
        <div class="content">    
                <article class="topcontent">
                        <header>
                        <h2><b><?php echo $firname; ?><?php echo " "; ?><?php echo $famname; ?>'s Requirements Status</b></h2>
                        <hr>
                        <h4 class="info"><b>Submitted Requirements</b></a></h4><br>   
                        </header>
                        <table>
                        <tr><td><?php echo $strReq; ?>

                        </table>
                    </content>       
                        </article>

                <article class="topcontent"> 
                    <header>
                        <h4 class="info"><b>Requirements Checklist</b></a></h4><br>
                    </header>

                    <content>
                        <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
                        <table border = "0">
                        <tr><td><input type="checkbox" name="req[]" value="Purchase Application (with NST code of seller)"> Purchase Application (with seller's NST code)<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Provistional Reservation"> Provisional Reservation - for Castilon Homes Ph2<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Pag-Ibig Loan Application"> Buyer's Undertaking (PAG-Ibig Loan Application) - for Castilon Homes Ph2<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Authorization to Conduct CI/BI"> Authorization to Conduct CI/BI<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="HDMF Loan Application Form"> HDMF Loan Application Form<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="3 pcs 1x1 Photo of buyer with signature at the back"> 3 pcs 1x1 Photo of buyer with signature at the back (to be attached to HDMF loan app form)<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="3 pcs 1x1 Photo of spouse with signature at the back"> 3 pcs 1x1 Photo of spouse with signature at the back<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Government Valid ID Buyer"> Gov't issued valid IDs buyer<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Government Valid ID Spouse"> Gov't issued valid IDs spouse<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Latest Tax Certificate Buyer"> Latest Community Tax Certificate - buyer*<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Latest Tax Certficate Spouse"> Latest Community Tax Certificate - spouse*<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Latest 1 month payslip / payroll sheet"> Latest 1 month payslip / payroll sheet<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Original & Notarized Certificate of Employment & Compensation"> Original & Notarized Certificate of Employment & Compensation *<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Tax Identification SSS No. Buyer"> Tax Identification / SSS No. - buyer (To be writen if PAF)<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Tax Identification SSS No. Spouse"> Tax Identification / SSS No. - spouse (To be writen if PAF)<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Photocopy of W2 - BIR Form 2316"> Photocopy of W2 - BIR Form 2316  (latest 1 year - for above minimum wage earners*)<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Photocopy of Birth Certificate"> Photocopy of Birth Certificate if single<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Photocopy of Marriage Contract"> Photocopy of Marriage Contract if married<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Proof of Billing"> Proof of Billing-res add (if renting, pls attach certification & valid ID of hse owner or brgy cert)*<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Certification from house owner starting residency and Valid ID of house owner"> Certification from house owner starting residency and Valid ID of house owner<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="Barangay Certification or clearance starting residence address"> Barangay Certification or clearance starting residence address<br></td></tr>
                        <tr><td><input type="checkbox" name="req[]" value="MSVS Form (Membership Status Verification Slip) & Questionaire - attached government issued valid ID"> MSVS Form (Membership Status Verification Slip) & Questionaire - pls attach gov't issued valid ID<br></td></tr>
                        </table>
                        <br>
                        <div id ="submit-button"><input type="submit" value="Update" name="update">
                        </form>
                        </content>       
                        </article>


        </div>
                <aside class="top-sidebar">
                    <article>
                    <li><a href="mainapp.php">Application List</a></li><hr><br>
                    <li><a href="mainagent.php">Agent's Profile</a></li><hr><br>
                    <li><a href="addagent.html">Add Agent</a></li><hr><br>
                    <li><a href="home.html">Manage Accounts</a></li><hr><br>
                    <li><a href="home.html">Log Out</a></li><hr>
                    </article>
                </aside>

                <aside class="middle-sidebar">
                <article>
                    <h4>Search the list:</h4><hr>
                    <form action="searchapp.php" method="GET">
                    <table>
                    <tr><td>Please enter the ID No. <input size="14" type="text" id="id" name="id"></td></tr>
                    <tr><td><input type="submit" id="submit" name="submit" value="View Profile"></td></tr>
                    </table>
                    </form>

                    <form action="requirements.php" method="GET">
                    <table>
                    <br><tr><td>Please enter the ID No. <input size="14" type="text" id="id" name="id"></td></tr>
                    <tr><td><input type="submit" id="submit" name="submit" value="View Requirements Status"></td></tr>
                    </table>
                    </form>

                </article>
                </aside>
        </div>

        <footer class="mainFooter">
            <p>Copyright &copy; Team Necktie 2014<br> A member of <a href="http://filinvest.com">Filinvest Corporation</a>. Visit us also in our <a href="http://facebook.com">Facebook</a> page.</p>
        </footer>

</body>
</html>

Recommended Answers

All 2 Replies

I dont understand what you want to say by this should not only be information but update.Can you explain in detail so that it becomes easy to work on it.

Practical post - Apropos , if your business is wanting a SOAP Notes , I saw a blank version here https://goo.gl/8o5lhx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.