0

What's wrong with my code? my save button is not working.. I need help please? thanks!

here's my code:

<?php include('header.php');
 session_start();
?> <?php include('navbar1.php');
?> </br> </br> </br> </br> <form class="form-horizontal" method="post" enctype="multipart/form-data"> <input type="text" name="applicant_name" placeholder = "Applicant Name" required> <br></br>
Applicant Type:
<br/> <select name="applicant_type"> <option value="">Please Specify</option> <option value="owner">Owner</option> <option value="common representative">Common Representative</option> </select> <br></br> <input type="text" name="address" placeholder = "Address" required> <br></br> <input type="text" name="concern" placeholder = "Concern" required> <br></br>
Requested By: <select name="requestedBy"> <option value="">Please Specify</option> <option value="joseph">Joseph</option> <option value="seena">Seena</option> <option value="ramon">Ramon</option> <option value="jason">Jason</option> <option value="francis">Francis</option> <option value="kyu">Kyu</option> <option value="rolly">Rolly</option> <option value="richard">Richard</option> <option value="ricardo">Ricardo</option> <option value="ian">Ian</option> <option value="jennefer">jennefer</option> <option value="others">Others</option> </select> <br></br>
Received By: <select name="receivedBy"> <option value="">Please Specify</option> <option value="joseph">Joseph</option> <option value="seena">Seena</option> <option value="ramon">Ramon</option> <option value="jason">Jason</option> <option value="francis">Francis</option> <option value="kyu">Kyu</option> <option value="rolly">Rolly</option> <option value="richard">Richard</option> <option value="ricardo">Ricardo</option> <option value="ian">Ian</option> <option value="jennefer">jennefer</option> <option value="others">Others</option> </select> <br></br>
Endorsed To: <select name="endorsedTo"> <option value="">Please Specify</option> <option value="joseph">Joseph</option> <option value="seena">Seena</option> <option value="ramon">Ramon</option> <option value="jason">Jason</option> <option value="francis">Francis</option> <option value="kyu">Kyu</option> <option value="rolly">Rolly</option> <option value="richard">Richard</option> <option value="ricardo">Ricardo</option> <option value="ian">Ian</option> <option value="jennefer">jennefer</option> <option value="others">Others</option> </select> <br></br> <input type="text" name="note" placeholder = "Note"> <br></br>
C/O: <select name="careoff"> <option value="">Please Specify</option> <option value="LMD">LMD</option> <option value="LCD">LCD</option> <option value="SIRS">SIRS</option> <option value="SIAS">SIAS</option> </select> <br></br> <div class = "header2">CLASSIFICATION
<br> <form action=""> <input type="radio" name="classification" value="Residential">Residential<br> <input type="radio" name="classification" value="Small Commercial">Small Commercial<br> <input type="radio" name="classification" value="Large Commercial">Large Commercial<br> <input type="radio" name="classification" value="Primary Metering">Primary Metering<br> <input type="radio" name="classification" value="Street Light">Street Light<br> </form> </div> <div class = "Requirements"> <div class = "header">REQUIREMENTS</div> <div class="checkbox"> <label><input type="checkbox" name = "requirements[]" value="Electrical Plan">Electrical Plan</label> </div> <div class="checkbox"> <label><input type="checkbox" name = "requirements[]" value="Vicinity/Relocation Plan">Vicinity/Relocation Plan</label> </div> <div class="checkbox"> <label><input type="checkbox" name = "requirements[]" value="Site Development">Site Development</label> </div> </div> <br></br> <br/> <button data-placement="right" id="save"  title="Click to Save Data" type="submit" name="save" class="btn btn-info"><i class="icon-save icon-large"></i> Save</button> </form> <!-- ====================================================================== --> 
<?php
if (isset($_POST['save'])) 
{
    $dbhost="localhost";
    $dbuser="root";
    $dbpass="";
    $conn=mysql_connect($dbhost, $dbuser, $dbpass)or die(mysql_error());
    $db=mysql_select_db('sdd application')or die(mysql_error());

   $name=$_POST['applicant_name'];
   $apptype=$_POST['applicant_type'];
   $address=$_POST['address'];
   $concern=$_POST['concern'];
   $requestedBy=$_POST['requestedBy'];
   $receivedBy=$_POST['receivedBy'];
   $endorsedTo=$_POST['endorsedTo'];
   $note=$_POST['note'];
   $careoff=$_POST['careoff'];
   $classification=$_POST['classification'];

   $requirements = implode(',', $_POST['requirements']);

    $sql = "INSERT INTO applicant(applicant_name, applicant_type, address, concern, requestedBy, receivedBy, endorsedTo, note, careoff, classification, requirements)
                    VALUES('$name', '$apptype', '$address', '$concern', '$requestedBy', '$receivedBy', '$endorsedTo', '$note', '$careoff', '$classification', '$requirements')";
    $result = mysql_query($sql);
    if ($result)
    {
        echo "successfully added";
    }
    else
    {
        echo "Please enter your data again";
    }
}
?>
4
Contributors
3
Replies
26
Views
2 Months
Discussion Span
Last Post by Dani
0

You have a form inside another form - may not correctly treated by browser

Edited by AndrisP

0

You say it isn't working, but is it writing any errors to the error log or output on the page?

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.