POST select query results in input

I am trying to post the results from a SELECT query or show blank for user to enter information.  The record I'm running has data that should be populating the field but I either get a blank field or $listing_agent reflected.  Line 129 is the offending code.   Thank you
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN http: //www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Property Inspection Form</title>
		<style type="text/css">
			body {
				background-color: #FFFFFF;
				margin-left: 10%;
				margin-right: 10%;
				border: 2px solid gray;
				padding: 20px 20px 20px 20px;
				font-family: Verdana, Helvetica, Arial, sans-serif;
				}
			table {
				margin-left: 20px;
				margin-right: 20px;
				border: thin solid white;
				caption-side: top;
				background-color: #E6E6FA
				}
			td, th {
                                font-weight: normal; 
                                font-size: 8pt; 
                                color: #000000; 
                                font-family: verdana, arial, helvetica, sans-serif;
                                text-decoration: none;
                                align="center"
				border: 2px solid white;
				padding: 5px;
				text-align: left;
				}
			caption {
				padding-top: 8px;
				}
			#prop_insp_form{
				background-color: #A3C2FF;
                                align="center";
				}
		</style>
	</head>
	<body>
<form enctype="multipart/form-data" method="POST" action="<?php echo $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; ?>">
<div id="nav">
<ul id="headerNav">
<li><a href="index.php" title="index">Home</a></li>
<li><a href="pending.php" title="Pending">Pending</a></li>
<li class="headerRight"><a href="/logout" title="Logout">Logout</a></li>
</ul>
</div>
<div id="?header?">
<h4><b>Instructions to Broker/Agent</b></h4>
<ul>
<li>Please inspect and complete within 1 business day, unless otherwise agreed upon </li>
</ul>
</div>

<?php
require_once('connvars.php');
$dbc=mysqli_connect(db_host,db_user,db_password,db_name);

  $job_id=mysqli_real_escape_string($dbc,$_GET['job_id']);
  $prop_addr_1=mysqli_real_escape_string($dbc,$_GET['prop_addr_1']);
  $prop_city=mysqli_real_escape_string($dbc,$_GET['prop_city']);
  $prop_state=mysqli_real_escape_string($dbc,$_GET['prop_state']);
  $prop_zip=mysqli_real_escape_string($dbc,$_GET['prop_zip']);
  $prop_county=mysqli_real_escape_string($dbc,$_GET['prop_county']);
 
    echo 'TC Number:  '. $tc_number .''; 
    echo 'Property Address:  '. $prop_addr_1. '<br />';  
    echo '  City:  '. $prop_city. '';
    echo '  State:  '. $prop_state. '';
    echo '  Zip:  '. $prop_zip .'<br />';
    echo '  County:  '. $prop_county . '';

$listing_agent=mysqli_real_escape_string($dbc,$_POST['listing_agent']);
$listed_realtor=mysqli_real_escape_string($dbc,$_POST['listed_realtor']);
$sale_sign=mysqli_real_escape_string($dbc,$_POST['sale_sign']); 
$sale_sign_comm=mysqli_real_escape_string($dbc,$_POST['sale_sign_comm']);
$vandalism=mysqli_real_escape_string($dbc,$_POST['vandalism']);
$vandalism_comm=mysqli_real_escape_string($dbc,$_POST['vandalism_comm']);
$code_viol=mysqli_real_escape_string($dbc,$_POST['code_viol']);
$code_viol_comm=mysqli_real_escape_string($dbc,$_POST['code_viol_comm']);
$health_safe=mysqli_real_escape_string($dbc,$_POST['health_safe']);
$health_safe_comm=mysqli_real_escape_string($dbc,$_POST['health_safe_comm']);
$prop_secure=mysqli_real_escape_string($dbc,$_POST['prop_secure']);
$prop_secure_comm=mysqli_real_escape_string($dbc,$_POST['prop_secure_comm']);
$land_main=mysqli_real_escape_string($dbc,$_POST['land_main']);
$land_main_comm=mysqli_real_escape_string($dbc,$_POST['land_main_comm']);
$int_clean=mysqli_real_escape_string($dbc,$_POST['int_clean']);
$int_clean_comm=mysqli_real_escape_string($dbc,$_POST['int_clean_comm']);
$electricity=mysqli_real_escape_string($dbc,$_POST['electricity']);
$water=mysqli_real_escape_string($dbc,$_POST['water']);
$water_comm=mysqli_real_escape_string($dbc,$_POST['water_comm']);
$winterized=mysqli_real_escape_string($dbc,$_POST['winterized']);
$winterized_comm=mysqli_real_escape_string($dbc,$_POST['winterized_comm']);
$add_comm=mysqli_real_escape_string($dbc,$_POST['add_comm']);
$mls_number=mysqli_real_escape_string($dbc,$_POST['mls_number']);
$mls_location=mysqli_real_escape_string($dbc,$_POST['mls_location']);
$curr_price=mysqli_real_escape_string($dbc,$_POST['curr_price']);
$prev_price=mysqli_real_escape_string($dbc,$_POST['prev_price']);
$dt_last_reduc=mysqli_real_escape_string($dbc,$_POST['dt_last_reduc']);

$query_pir_existing="SELECT * FROM prop_insp WHERE job_id='$job_id'"; 
$result_pir_existing=mysqli_query($dbc,$query_pir_existing) or die('ERROR PIR SELECT');  
if(isset($_POST['submit'])){
     //insert new record to prop_insp
     $query_pir_insert="INSERT INTO prop_insp(job_id,listing_agent,listed_realtor,sale_sign,sale_sign_comm,vandalism,vandalism_comm,health_safe,health_safe_comm,prop_secure,prop_secure_comm,land_main,land_main_comm,electricity,electricity_comm,water,water_comm,int_clean,int_clean_comm,winterized,winterized_comm,listing_office,code_viol,code_viol_comm)
VALUES('$job_id','$listing_agent','$listed_realtor','$sale_sign','$sale_sign_comm','$vandalism','$vandalism_comm','$health_safe','$health_safe_comm','$prop_secure','$prop_secure_comm','$land_main','$land_main_comm','$electricity','$electricity_comm','$water','$water_comm','$int_clean','$int_clean_comm','$winterized','$winterized_comm','$listing_office','$code_viol','$code_viol_comm')";
     $result_pir_insert=mysqli_query($dbc,$query_pir_insert) or die('ERROR PIR INSERT');

//update job fields
     $query_job_update="UPDATE job 
                        SET  mls_number='$mls_number',curr_price='$curr_price',prev_price='$prev_price',dt_last_reduc='$dt_last_reduc', mls_location='$mls_location'
                        WHERE job_ID='$job_id'";
     $result_job_update=mysqli_query($dbc,$query_job_update)or die('ERROR JOB UPDATE');

}

?>            
<h2><center>PROPERTY INSPECTION FORM</center></h2>
<input value="Submit Data" name="submit" type="submit" />
<table>
<tbody>
<tr>
<th>Listing Agent Name</th>
<td></td>
<td><input name="listing_agent" value="<?php echo $listing_agent; ?>" type="text" /></td>
</tr>
<tr>
<th>Listing Agent Office</th>
<td></td>
<td><input name="listing_office" type="text" /></td>
</tr>
<tr>
<th>Is the property currently listed on any listing databases?</th>
<td>
 <?php

         //drop down for listing databases 
         $dd_listing_db="select listing_db_id, listing_db_name from listing_db order by listing_db_name ASC";
         $dd_listing_db_result=mysqli_query($dbc,$dd_listing_db);
          echo "<select name=\"listing_db_id\">\n"; 
          echo "<option value=\"NULL\">Select Listing Database</option>\n";
           while($row = mysqli_fetch_array($dd_listing_db_result)){
           $listing_db_id = $row['listing_db_id'];
           $listing_db_name = $row['listing_db_name'];
           echo "<option value=\"$listing_db_id\">$listing_db_name</option>\n";
          }
          echo"</select>\n";
        ?>
        <td><input name="mls_number" type="text" /></td>
<td><input type="file" id="uploadmls" name="uploadmls" /></td>
</tr>
<tr>
<th>Is the property currently listed on Realtor.com?</th>
<td>Yes<input name="listed_realtor" value="Y" type="radio" /> No<input name="listed_realtor" value="N" type="radio" /></td>
</tr>
<tr>
<th>Current Price: </th>
<td></td>
<td><input name="curr_price" type="currency" /></td>
</tr>
<tr>
<th>Previous Price: </th>
<td></td>
<td><input name="curr_price" type="currency" /></td>
</tr>
<tr>
<th>Date of Last Price Reduction: </th>
<td></td>
<td><input name="dt_last_reduc" type="date" />
<p>&nbsp;</p>
</td>
</tr>
<tr>
<th>Is there a for sale sign visible from the street?</th>
<td>Yes<input name="sale_sign" value="Y" type="radio" /> No<input name="sale_sign" value="N" type="radio" /></td>
<td></td>
<td><textarea name="sale_sign_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any signs of vadalism?</th>
<td>Yes<input name="vandalism" value="Y" type="radio" /> No<input name="vandalism" value="N" type="radio" /></td>
<td></td>
<td><textarea name="vandalism_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any visible signs of code violations?</th>
<td>Yes<input name="code_viol" value="Y" type="radio" /> No<input name="code_viol" value="N" type="radio" /></td>
<td></td>
<td><textarea name="code_viol_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any health and safety issues with the property?</th>
<td>Yes<input name="health_safe" value="Y" type="radio" /> No<input name="health_safe" value="N" type="radio" /></td>
<td></td>
<td><textarea name="health_safe_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the property secured?</th>
<td>Yes<input name="prop_secure" value="Y" type="radio" /> No<input name="prop_secure" value="N" type="radio" /></td>
<td></td>
<td><textarea name="prop_secure_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the landscaping maintained?</th>
<td>Yes<input name="land_main" value="Y" type="radio" />No<input name="land_main" value="N" type="radio" /></td>
<td></td>
<td><textarea name="land_main_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the interior of the property clean?</th>
<td>Yes<input name="int_clean" value="Y" type="radio" /> No<input name="int_clean" value="N" type="radio" /></td>
<td></td>
<td><textarea name="int_clean_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the electricity turned on?</th>
<td>Yes<input name="electricity" value="Y" type="radio" /> No<input name="electricity" value="N" type="radio" /></td>
<td></td>
<td><textarea name="electricity_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the water turned on?</th>
<td>Yes<input name="water" value="Y" type="radio" /> No<input name="water" value="N" type="radio" /></td>
<td></td>
<td><textarea name="water_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>If between September and April, are there notices that the home has been winterized? (please provide photos of notices)?</th>
<td>Yes<input name="winterized" value="Y" type="radio" /> No<input name="winterized" value="N" type="radio" />N/A<input name="winterized" value="na" type="radio" /></td>
<td></td>
<td><textarea name="winterized_comm" rows="2" cols="40"></textarea></td>
</tr>
</tbody>
</table><br />
<table>
<tbody>
<tr>
<th>Please provide any additional comments, such as, condition of neighboring homes, current real estate market conditions in the area.</th>
</tr>
<tr>
<td><textarea name="add_comm" rows="10" cols="111"></textarea></td>
</tr>
</tbody>
</table><br />

<table>
 <tbody>
  <tr>
   <th>IMAGE HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center>SUBJECT FRONT</center></th>
       </tr>
        <td><input type="file" id="upload_front" name="upload_front" /></td>
     </table>
    </td>
   </tr>
   <tr>
<th>IMAGE 2 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center>
        <?php
         require_once('connvars.php');
         //drop down for image 2 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id2 = $row['location_id'];
           $location_name2 = $row['location_name'];
           echo "<option value=\"$location_id2\">$location_name2</option>\n";
          }
          echo"</select>\n";
        ?>
     </center></th>
      </tr>
       <td><input type="file" id="upload_2" name="upload_2" /></td>
      </tr>
    </table>
   </td>
 </tr>

<th>IMAGE 3 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center>
<?php
         require_once('connvars.php');
         //drop down for image 3 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id3 = $row['location_id'];
           $location_name3 = $row['location_name'];
           echo "<option value=\"$location_id3\">$location_name3</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
      </tr>
       <td><input type="file" id="upload_3" name="upload_3" /></td>
      </tr>
   </table>
</td>
</tr>

   <th>IMAGE 4 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 4 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id4 = $row['location_id'];
           $location_name4 = $row['location_name'];
           echo "<option value=\"$location_id4\">$location_name4</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_4" name="upload_4" /></td>
      </tr>
     </table>
    </td>
   </tr>
    
<th>IMAGE 5 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 5 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id5 = $row['location_id'];
           $location_name5 = $row['location_name'];
           echo "<option value=\"$location_id5\">$location_name5</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_5" name="upload_5" /></td>
      </tr>
     </table>
    </td>
   </tr>

<th>IMAGE 6 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center><?php
         require_once('connvars.php');
         //drop down for image 6 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id6 = $row['location_id'];
           $location_name6 = $row['location_name'];
           echo "<option value=\"$location_id6\">$location_name6</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
      </tr>
       <td><input type="file" id="upload_6" name="upload_6" /></td>
      </tr>
</table>
</td>
</tr>

   <th>IMAGE 7 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 7 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id7 = $row['location_id'];
           $location_name7 = $row['location_name'];
           echo "<option value=\"$location_id7\">$location_name7</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_7" name="upload_7" /></td>
     </table>
    </td>
   </tr>


   <th>IMAGE 8 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 8 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id8 = $row['location_id'];
           $location_name8 = $row['location_name'];
           echo "<option value=\"$location_id8\">$location_name8</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_8" name="upload_8" /></td>
      </tr>
     </table>
    </td>
   </tr>
    
<th>IMAGE 9 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 9 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id9 = $row['location_id'];
           $location_name9 = $row['location_name'];
           echo "<option value=\"$location_id9\">$location_name9</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_9" name="upload_9" /></td>
      </tr>
     </table>
    </td>
   </tr>

<th>IMAGE 10 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center><?php
         require_once('connvars.php');
         //drop down for image 10 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id10 = $row['location_id'];
           $location_name10 = $row['location_name'];
           echo "<option value=\"$location_id10\">$location_name10</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
      </tr>
       <td><input type="file" id="upload_10" name="upload_10" /></td>
      </tr>
</table>
</td>
</tr>

   <th>IMAGE 11 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 11 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id11 = $row['location_id'];
           $location_name11 = $row['location_name'];
           echo "<option value=\"$location_id11\">$location_name11</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_11" name="upload_11" /></td>
     </table>
    </td>
   </tr>

<th>IMAGE 12 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 12 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id12 = $row['location_id'];
           $location_name12 = $row['location_name'];
           echo "<option value=\"$location_id12\">$location_name12</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_12" name="upload_12" /></td>
     </table>
    </td>
   </tr>
    </table>
   </td>
 </tbody>
</table><br />


Agent Name: <input name="agent_name" type="text" /> Date Inspection Completed:  <input name="completed_date" type="date" />
<p>&nbsp;</p>
<input value="Submit Data" name="submit" type="submit" />
<input value="Produce PDF" name="propinsppdf" type="button" onClick="window.open('<?php echo urlencode(urlencode('propinsp.php?job_id='.$row['job_id'].'&amp;tc_number='.$row['tc_number'].'&amp;prop_addr_1='.$row['prop_addr_1'].'&amp;prop_city=' . $row['prop_city'].'&amp;prop_state=' . $row['prop_zip'].'&amp;prop_county='.$row['prop_county'])); ?>')" /></p><br />


</form>
</body>
</html>

Open in new window

rcowen00Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AielloJCommented:
rcowen00:

You shouldn't have quotes around the variable $listing_agent, or any other variables, in your VALUES statement part of your SQL insert statement.

AielloJ
0
rcowen00Author Commented:
Is the code below what you intended, because now my INSERT query is not working and the field is still blank?  Thank you.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN http: //www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Property Inspection Form</title>
		<style type="text/css">
			body {
				background-color: #FFFFFF;
				margin-left: 10%;
				margin-right: 10%;
				border: 2px solid gray;
				padding: 20px 20px 20px 20px;
				font-family: Verdana, Helvetica, Arial, sans-serif;
				}
			table {
				margin-left: 20px;
				margin-right: 20px;
				border: thin solid white;
				caption-side: top;
				background-color: #E6E6FA
				}
			td, th {
                                font-weight: normal; 
                                font-size: 8pt; 
                                color: #000000; 
                                font-family: verdana, arial, helvetica, sans-serif;
                                text-decoration: none;
                                align="center"
				border: 2px solid white;
				padding: 5px;
				text-align: left;
				}
			caption {
				padding-top: 8px;
				}
			#prop_insp_form{
				background-color: #A3C2FF;
                                align="center";
				}
		</style>
	</head>
	<body>
<form enctype="multipart/form-data" method="POST" action="<?php echo $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; ?>">
<div id="nav">
<ul id="headerNav">
<li><a href="index.php" title="index">Home</a></li>
<li><a href="pending.php" title="Pending">Pending</a></li>
<li class="headerRight"><a href="/logout" title="Logout">Logout</a></li>
</ul>
</div>
<div id="?header?">
<h4><b>Instructions to Broker/Agent</b></h4>
<ul>
<li>Please inspect and complete within 1 business day, unless otherwise agreed upon </li>
</ul>
</div>

<?php
require_once('connvars.php');
$dbc=mysqli_connect(db_host,db_user,db_password,db_name);

  $job_id=mysqli_real_escape_string($dbc,$_GET['job_id']);
  $prop_addr_1=mysqli_real_escape_string($dbc,$_GET['prop_addr_1']);
  $prop_city=mysqli_real_escape_string($dbc,$_GET['prop_city']);
  $prop_state=mysqli_real_escape_string($dbc,$_GET['prop_state']);
  $prop_zip=mysqli_real_escape_string($dbc,$_GET['prop_zip']);
  $prop_county=mysqli_real_escape_string($dbc,$_GET['prop_county']);
 
    echo 'TC Number:  '. $tc_number .''; 
    echo 'Property Address:  '. $prop_addr_1. '<br />';  
    echo '  City:  '. $prop_city. '';
    echo '  State:  '. $prop_state. '';
    echo '  Zip:  '. $prop_zip .'<br />';
    echo '  County:  '. $prop_county . '';

$listing_agent=mysqli_real_escape_string($dbc,$_POST['listing_agent']);
$listed_realtor=mysqli_real_escape_string($dbc,$_POST['listed_realtor']);
$sale_sign=mysqli_real_escape_string($dbc,$_POST['sale_sign']); 
$sale_sign_comm=mysqli_real_escape_string($dbc,$_POST['sale_sign_comm']);
$vandalism=mysqli_real_escape_string($dbc,$_POST['vandalism']);
$vandalism_comm=mysqli_real_escape_string($dbc,$_POST['vandalism_comm']);
$code_viol=mysqli_real_escape_string($dbc,$_POST['code_viol']);
$code_viol_comm=mysqli_real_escape_string($dbc,$_POST['code_viol_comm']);
$health_safe=mysqli_real_escape_string($dbc,$_POST['health_safe']);
$health_safe_comm=mysqli_real_escape_string($dbc,$_POST['health_safe_comm']);
$prop_secure=mysqli_real_escape_string($dbc,$_POST['prop_secure']);
$prop_secure_comm=mysqli_real_escape_string($dbc,$_POST['prop_secure_comm']);
$land_main=mysqli_real_escape_string($dbc,$_POST['land_main']);
$land_main_comm=mysqli_real_escape_string($dbc,$_POST['land_main_comm']);
$int_clean=mysqli_real_escape_string($dbc,$_POST['int_clean']);
$int_clean_comm=mysqli_real_escape_string($dbc,$_POST['int_clean_comm']);
$electricity=mysqli_real_escape_string($dbc,$_POST['electricity']);
$water=mysqli_real_escape_string($dbc,$_POST['water']);
$water_comm=mysqli_real_escape_string($dbc,$_POST['water_comm']);
$winterized=mysqli_real_escape_string($dbc,$_POST['winterized']);
$winterized_comm=mysqli_real_escape_string($dbc,$_POST['winterized_comm']);
$add_comm=mysqli_real_escape_string($dbc,$_POST['add_comm']);
$mls_number=mysqli_real_escape_string($dbc,$_POST['mls_number']);
$mls_location=mysqli_real_escape_string($dbc,$_POST['mls_location']);
$curr_price=mysqli_real_escape_string($dbc,$_POST['curr_price']);
$prev_price=mysqli_real_escape_string($dbc,$_POST['prev_price']);
$dt_last_reduc=mysqli_real_escape_string($dbc,$_POST['dt_last_reduc']);

$query_pir_existing="SELECT * FROM prop_insp WHERE job_id='$job_id'";   
if(isset($_POST['submit'])){
     //insert new record to prop_insp
     $query_pir_insert="INSERT INTO prop_insp(job_id,listing_agent,listed_realtor,sale_sign,sale_sign_comm,vandalism,vandalism_comm,health_safe,health_safe_comm,prop_secure,prop_secure_comm,land_main,land_main_comm,electricity,electricity_comm,water,water_comm,int_clean,int_clean_comm,winterized,winterized_comm,listing_office,code_viol,code_viol_comm)
VALUES($job_id,$listing_agent,$listed_realtor,$sale_sign,$sale_sign_comm,$vandalism,$vandalism_comm,$health_safe,$health_safe_comm,$prop_secure,$prop_secure_comm,$land_main,$land_main_comm,$electricity,$electricity_comm,$water,$water_comm,$int_clean,$int_clean_comm,$winterized,$winterized_comm,$listing_office,$code_viol,$code_viol_comm)";
     $result_pir_insert=mysqli_query($dbc,$query_pir_insert) or die('ERROR PIR INSERT');

//update job fields
     $query_job_update="UPDATE job 
                        SET  mls_number='$mls_number',curr_price='$curr_price',prev_price='$prev_price',dt_last_reduc='$dt_last_reduc', mls_location='$mls_location'
                        WHERE job_ID='$job_id'";
     $result_job_update=mysqli_query($dbc,$query_job_update)or die('ERROR JOB UPDATE');

}

?>            
<h2><center>PROPERTY INSPECTION FORM</center></h2>
<input value="Submit Data" name="submit" type="submit" />
<table>
<tbody>
<tr>
<th>Listing Agent Name</th>
<td></td>
<td><input name="listing_agent" value="<?php echo $listing_agent; ?>" type="text" /></td>
</tr>
<tr>
<th>Listing Agent Office</th>
<td></td>
<td><input name="listing_office" type="text" /></td>
</tr>
<tr>
<th>Is the property currently listed on any listing databases?</th>
<td>
 <?php

         //drop down for listing databases 
         $dd_listing_db="select listing_db_id, listing_db_name from listing_db order by listing_db_name ASC";
         $dd_listing_db_result=mysqli_query($dbc,$dd_listing_db);
          echo "<select name=\"listing_db_id\">\n"; 
          echo "<option value=\"NULL\">Select Listing Database</option>\n";
           while($row = mysqli_fetch_array($dd_listing_db_result)){
           $listing_db_id = $row['listing_db_id'];
           $listing_db_name = $row['listing_db_name'];
           echo "<option value=\"$listing_db_id\">$listing_db_name</option>\n";
          }
          echo"</select>\n";
        ?>
        <td><input name="mls_number" type="text" /></td>
<td><input type="file" id="uploadmls" name="uploadmls" /></td>
</tr>
<tr>
<th>Is the property currently listed on Realtor.com?</th>
<td>Yes<input name="listed_realtor" value="Y" type="radio" /> No<input name="listed_realtor" value="N" type="radio" /></td>
</tr>
<tr>
<th>Current Price: </th>
<td></td>
<td><input name="curr_price" type="currency" /></td>
</tr>
<tr>
<th>Previous Price: </th>
<td></td>
<td><input name="curr_price" type="currency" /></td>
</tr>
<tr>
<th>Date of Last Price Reduction: </th>
<td></td>
<td><input name="dt_last_reduc" type="date" />
<p>&nbsp;</p>
</td>
</tr>
<tr>
<th>Is there a for sale sign visible from the street?</th>
<td>Yes<input name="sale_sign" value="Y" type="radio" /> No<input name="sale_sign" value="N" type="radio" /></td>
<td></td>
<td><textarea name="sale_sign_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any signs of vadalism?</th>
<td>Yes<input name="vandalism" value="Y" type="radio" /> No<input name="vandalism" value="N" type="radio" /></td>
<td></td>
<td><textarea name="vandalism_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any visible signs of code violations?</th>
<td>Yes<input name="code_viol" value="Y" type="radio" /> No<input name="code_viol" value="N" type="radio" /></td>
<td></td>
<td><textarea name="code_viol_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any health and safety issues with the property?</th>
<td>Yes<input name="health_safe" value="Y" type="radio" /> No<input name="health_safe" value="N" type="radio" /></td>
<td></td>
<td><textarea name="health_safe_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the property secured?</th>
<td>Yes<input name="prop_secure" value="Y" type="radio" /> No<input name="prop_secure" value="N" type="radio" /></td>
<td></td>
<td><textarea name="prop_secure_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the landscaping maintained?</th>
<td>Yes<input name="land_main" value="Y" type="radio" />No<input name="land_main" value="N" type="radio" /></td>
<td></td>
<td><textarea name="land_main_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the interior of the property clean?</th>
<td>Yes<input name="int_clean" value="Y" type="radio" /> No<input name="int_clean" value="N" type="radio" /></td>
<td></td>
<td><textarea name="int_clean_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the electricity turned on?</th>
<td>Yes<input name="electricity" value="Y" type="radio" /> No<input name="electricity" value="N" type="radio" /></td>
<td></td>
<td><textarea name="electricity_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the water turned on?</th>
<td>Yes<input name="water" value="Y" type="radio" /> No<input name="water" value="N" type="radio" /></td>
<td></td>
<td><textarea name="water_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>If between September and April, are there notices that the home has been winterized? (please provide photos of notices)?</th>
<td>Yes<input name="winterized" value="Y" type="radio" /> No<input name="winterized" value="N" type="radio" />N/A<input name="winterized" value="na" type="radio" /></td>
<td></td>
<td><textarea name="winterized_comm" rows="2" cols="40"></textarea></td>
</tr>
</tbody>
</table><br />
<table>
<tbody>
<tr>
<th>Please provide any additional comments, such as, condition of neighboring homes, current real estate market conditions in the area.</th>
</tr>
<tr>
<td><textarea name="add_comm" rows="10" cols="111"></textarea></td>
</tr>
</tbody>
</table><br />

<table>
 <tbody>
  <tr>
   <th>IMAGE HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center>SUBJECT FRONT</center></th>
       </tr>
        <td><input type="file" id="upload_front" name="upload_front" /></td>
     </table>
    </td>
   </tr>
   <tr>
<th>IMAGE 2 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center>
        <?php
         require_once('connvars.php');
         //drop down for image 2 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id2 = $row['location_id'];
           $location_name2 = $row['location_name'];
           echo "<option value=\"$location_id2\">$location_name2</option>\n";
          }
          echo"</select>\n";
        ?>
     </center></th>
      </tr>
       <td><input type="file" id="upload_2" name="upload_2" /></td>
      </tr>
    </table>
   </td>
 </tr>

<th>IMAGE 3 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center>
<?php
         require_once('connvars.php');
         //drop down for image 3 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id3 = $row['location_id'];
           $location_name3 = $row['location_name'];
           echo "<option value=\"$location_id3\">$location_name3</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
      </tr>
       <td><input type="file" id="upload_3" name="upload_3" /></td>
      </tr>
   </table>
</td>
</tr>

   <th>IMAGE 4 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 4 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id4 = $row['location_id'];
           $location_name4 = $row['location_name'];
           echo "<option value=\"$location_id4\">$location_name4</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_4" name="upload_4" /></td>
      </tr>
     </table>
    </td>
   </tr>
    
<th>IMAGE 5 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 5 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id5 = $row['location_id'];
           $location_name5 = $row['location_name'];
           echo "<option value=\"$location_id5\">$location_name5</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_5" name="upload_5" /></td>
      </tr>
     </table>
    </td>
   </tr>

<th>IMAGE 6 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center><?php
         require_once('connvars.php');
         //drop down for image 6 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id6 = $row['location_id'];
           $location_name6 = $row['location_name'];
           echo "<option value=\"$location_id6\">$location_name6</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
      </tr>
       <td><input type="file" id="upload_6" name="upload_6" /></td>
      </tr>
</table>
</td>
</tr>

   <th>IMAGE 7 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 7 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id7 = $row['location_id'];
           $location_name7 = $row['location_name'];
           echo "<option value=\"$location_id7\">$location_name7</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_7" name="upload_7" /></td>
     </table>
    </td>
   </tr>


   <th>IMAGE 8 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 8 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id8 = $row['location_id'];
           $location_name8 = $row['location_name'];
           echo "<option value=\"$location_id8\">$location_name8</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_8" name="upload_8" /></td>
      </tr>
     </table>
    </td>
   </tr>
    
<th>IMAGE 9 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 9 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id9 = $row['location_id'];
           $location_name9 = $row['location_name'];
           echo "<option value=\"$location_id9\">$location_name9</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_9" name="upload_9" /></td>
      </tr>
     </table>
    </td>
   </tr>

<th>IMAGE 10 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center><?php
         require_once('connvars.php');
         //drop down for image 10 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id10 = $row['location_id'];
           $location_name10 = $row['location_name'];
           echo "<option value=\"$location_id10\">$location_name10</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
      </tr>
       <td><input type="file" id="upload_10" name="upload_10" /></td>
      </tr>
</table>
</td>
</tr>

   <th>IMAGE 11 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 11 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id11 = $row['location_id'];
           $location_name11 = $row['location_name'];
           echo "<option value=\"$location_id11\">$location_name11</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_11" name="upload_11" /></td>
     </table>
    </td>
   </tr>

<th>IMAGE 12 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 12 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id12 = $row['location_id'];
           $location_name12 = $row['location_name'];
           echo "<option value=\"$location_id12\">$location_name12</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_12" name="upload_12" /></td>
     </table>
    </td>
   </tr>
    </table>
   </td>
 </tbody>
</table><br />


Agent Name: <input name="agent_name" type="text" /> Date Inspection Completed:  <input name="completed_date" type="date" />
<p>&nbsp;</p>
<input value="Submit Data" name="submit" type="submit" />
<input value="Produce PDF" name="propinsppdf" type="button" onClick="window.open('<?php echo urlencode(urlencode('prop_insp_pdf.php?prop_addr_1=' . $prop_addr_1)); ?>')" /></p><br />


</form>
</body>
</html>

Open in new window

0
Ludwig DiehlSystems ArchitectCommented:
Could you please send you database structure ( no data required). I'm trying to optimize your code however I need your db structure in order to test it. thx
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

rcowen00Author Commented:
Ok, how do I do that quickly?  
0
hieloCommented:
try:

<td><input name="listing_agent" value="<?php echo (isset($listing_agent) && !empty($listing_agent) ? htmlentities($listing_agent,ENT_QUOTES) : ''); ?>" type="text" /></td>

Open in new window

0
rcowen00Author Commented:
Still blank hielo
0
hieloCommented:
>>I am trying to post the results from a SELECT query or show blank for user to enter information.
On what you posted, which of the select are you referring to?

$listing_agent is being initalized from the querystring NOT from a db query nor POST
0
hieloCommented:
>>$listing_agent is being initalized from the querystring NOT from a db query nor POST
I meant:
$listing_agent is being initalized from  POST NOT from a db query nor the querystring
In other words, upon first load, $listing_agent will be blank. You would need to submit/post something to the page first.
0
rcowen00Author Commented:
aaaaahhhhhhh!  The query I am trying to populate the field from is $query_pir_existing.  
0
hieloCommented:
you are not executing that query actually. Try:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN http: //www.w3.org/TR/html4/loose.dtd">

<html>
	<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
		<title>Property Inspection Form</title>
		<style type="text/css">
			body {
				background-color: #FFFFFF;
				margin-left: 10%;
				margin-right: 10%;
				border: 2px solid gray;
				padding: 20px 20px 20px 20px;
				font-family: Verdana, Helvetica, Arial, sans-serif;
				}
			table {
				margin-left: 20px;
				margin-right: 20px;
				border: thin solid white;
				caption-side: top;
				background-color: #E6E6FA
				}
			td, th {
                                font-weight: normal; 
                                font-size: 8pt; 
                                color: #000000; 
                                font-family: verdana, arial, helvetica, sans-serif;
                                text-decoration: none;
                                align="center"
				border: 2px solid white;
				padding: 5px;
				text-align: left;
				}
			caption {
				padding-top: 8px;
				}
			#prop_insp_form{
				background-color: #A3C2FF;
                                align="center";
				}
		</style>
	</head>
	<body>
<form enctype="multipart/form-data" method="POST" action="<?php echo $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']; ?>">
<div id="nav">
<ul id="headerNav">
<li><a href="index.php" title="index">Home</a></li>
<li><a href="pending.php" title="Pending">Pending</a></li>
<li class="headerRight"><a href="/logout" title="Logout">Logout</a></li>
</ul>
</div>
<div id="?header?">
<h4><b>Instructions to Broker/Agent</b></h4>
<ul>
<li>Please inspect and complete within 1 business day, unless otherwise agreed upon </li>
</ul>
</div>

<?php
require_once('connvars.php');
$dbc=mysqli_connect(db_host,db_user,db_password,db_name);

  $job_id=mysqli_real_escape_string($dbc,$_GET['job_id']);
  $prop_addr_1=mysqli_real_escape_string($dbc,$_GET['prop_addr_1']);
  $prop_city=mysqli_real_escape_string($dbc,$_GET['prop_city']);
  $prop_state=mysqli_real_escape_string($dbc,$_GET['prop_state']);
  $prop_zip=mysqli_real_escape_string($dbc,$_GET['prop_zip']);
  $prop_county=mysqli_real_escape_string($dbc,$_GET['prop_county']);
 
    echo 'TC Number:  '. $tc_number .''; 
    echo 'Property Address:  '. $prop_addr_1. '<br />';  
    echo '  City:  '. $prop_city. '';
    echo '  State:  '. $prop_state. '';
    echo '  Zip:  '. $prop_zip .'<br />';
    echo '  County:  '. $prop_county . '';

$listing_agent=mysqli_real_escape_string($dbc,$_POST['listing_agent']);
$listed_realtor=mysqli_real_escape_string($dbc,$_POST['listed_realtor']);
$sale_sign=mysqli_real_escape_string($dbc,$_POST['sale_sign']); 
$sale_sign_comm=mysqli_real_escape_string($dbc,$_POST['sale_sign_comm']);
$vandalism=mysqli_real_escape_string($dbc,$_POST['vandalism']);
$vandalism_comm=mysqli_real_escape_string($dbc,$_POST['vandalism_comm']);
$code_viol=mysqli_real_escape_string($dbc,$_POST['code_viol']);
$code_viol_comm=mysqli_real_escape_string($dbc,$_POST['code_viol_comm']);
$health_safe=mysqli_real_escape_string($dbc,$_POST['health_safe']);
$health_safe_comm=mysqli_real_escape_string($dbc,$_POST['health_safe_comm']);
$prop_secure=mysqli_real_escape_string($dbc,$_POST['prop_secure']);
$prop_secure_comm=mysqli_real_escape_string($dbc,$_POST['prop_secure_comm']);
$land_main=mysqli_real_escape_string($dbc,$_POST['land_main']);
$land_main_comm=mysqli_real_escape_string($dbc,$_POST['land_main_comm']);
$int_clean=mysqli_real_escape_string($dbc,$_POST['int_clean']);
$int_clean_comm=mysqli_real_escape_string($dbc,$_POST['int_clean_comm']);
$electricity=mysqli_real_escape_string($dbc,$_POST['electricity']);
$water=mysqli_real_escape_string($dbc,$_POST['water']);
$water_comm=mysqli_real_escape_string($dbc,$_POST['water_comm']);
$winterized=mysqli_real_escape_string($dbc,$_POST['winterized']);
$winterized_comm=mysqli_real_escape_string($dbc,$_POST['winterized_comm']);
$add_comm=mysqli_real_escape_string($dbc,$_POST['add_comm']);
$mls_number=mysqli_real_escape_string($dbc,$_POST['mls_number']);
$mls_location=mysqli_real_escape_string($dbc,$_POST['mls_location']);
$curr_price=mysqli_real_escape_string($dbc,$_POST['curr_price']);
$prev_price=mysqli_real_escape_string($dbc,$_POST['prev_price']);
$dt_last_reduc=mysqli_real_escape_string($dbc,$_POST['dt_last_reduc']);

$query_pir_existing="SELECT * FROM prop_insp WHERE job_id='$job_id'";   
if(isset($_POST['submit'])){
     //insert new record to prop_insp
     $query_pir_insert="INSERT INTO prop_insp(job_id,listing_agent,listed_realtor,sale_sign,sale_sign_comm,vandalism,vandalism_comm,health_safe,health_safe_comm,prop_secure,prop_secure_comm,land_main,land_main_comm,electricity,electricity_comm,water,water_comm,int_clean,int_clean_comm,winterized,winterized_comm,listing_office,code_viol,code_viol_comm)
VALUES($job_id,$listing_agent,$listed_realtor,$sale_sign,$sale_sign_comm,$vandalism,$vandalism_comm,$health_safe,$health_safe_comm,$prop_secure,$prop_secure_comm,$land_main,$land_main_comm,$electricity,$electricity_comm,$water,$water_comm,$int_clean,$int_clean_comm,$winterized,$winterized_comm,$listing_office,$code_viol,$code_viol_comm)";
     $result_pir_insert=mysqli_query($dbc,$query_pir_insert) or die('ERROR PIR INSERT');

//update job fields
     $query_job_update="UPDATE job 
                        SET  mls_number='$mls_number',curr_price='$curr_price',prev_price='$prev_price',dt_last_reduc='$dt_last_reduc', mls_location='$mls_location'
                        WHERE job_ID='$job_id'";
     $result_job_update=mysqli_query($dbc,$query_job_update)or die('ERROR JOB UPDATE');

}

?>            
<h2><center>PROPERTY INSPECTION FORM</center></h2>
<input value="Submit Data" name="submit" type="submit" />
<table>
<tbody>
<tr>
<th>Listing Agent Name</th>
<td></td>
<?php
$query_pir_existing_result=mysql_query($query_pir_existing) or die(mysql_error());
if( mysql_num_rows($query_pir_existing_result)>0)
{
	 $row = mysql_fetch_assoc($query_pir_existing_result);
	 $listing_agent=$row['listing_agent'];
}
?>
<td><input name="listing_agent" value="<?php echo (isset($listing_agent) && !empty($listing_agent) ? htmlentities($listing_agent,ENT_QUOTES) : ''); ?>" type="text" /></td>
</tr>
<tr>
<th>Listing Agent Office</th>
<td></td>
<td><input name="listing_office" type="text" /></td>
</tr>
<tr>
<th>Is the property currently listed on any listing databases?</th>
<td>
 <?php

         //drop down for listing databases 
         $dd_listing_db="select listing_db_id, listing_db_name from listing_db order by listing_db_name ASC";
         $dd_listing_db_result=mysqli_query($dbc,$dd_listing_db);
          echo "<select name=\"listing_db_id\">\n"; 
          echo "<option value=\"NULL\">Select Listing Database</option>\n";
           while($row = mysqli_fetch_array($dd_listing_db_result)){
           $listing_db_id = $row['listing_db_id'];
           $listing_db_name = $row['listing_db_name'];
           echo "<option value=\"$listing_db_id\">$listing_db_name</option>\n";
          }
          echo"</select>\n";
        ?>
        <td><input name="mls_number" type="text" /></td>
<td><input type="file" id="uploadmls" name="uploadmls" /></td>
</tr>
<tr>
<th>Is the property currently listed on Realtor.com?</th>
<td>Yes<input name="listed_realtor" value="Y" type="radio" /> No<input name="listed_realtor" value="N" type="radio" /></td>
</tr>
<tr>
<th>Current Price: </th>
<td></td>
<td><input name="curr_price" type="currency" /></td>
</tr>
<tr>
<th>Previous Price: </th>
<td></td>
<td><input name="curr_price" type="currency" /></td>
</tr>
<tr>
<th>Date of Last Price Reduction: </th>
<td></td>
<td><input name="dt_last_reduc" type="date" />
<p>&nbsp;</p>
</td>
</tr>
<tr>
<th>Is there a for sale sign visible from the street?</th>
<td>Yes<input name="sale_sign" value="Y" type="radio" /> No<input name="sale_sign" value="N" type="radio" /></td>
<td></td>
<td><textarea name="sale_sign_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any signs of vadalism?</th>
<td>Yes<input name="vandalism" value="Y" type="radio" /> No<input name="vandalism" value="N" type="radio" /></td>
<td></td>
<td><textarea name="vandalism_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any visible signs of code violations?</th>
<td>Yes<input name="code_viol" value="Y" type="radio" /> No<input name="code_viol" value="N" type="radio" /></td>
<td></td>
<td><textarea name="code_viol_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Are there any health and safety issues with the property?</th>
<td>Yes<input name="health_safe" value="Y" type="radio" /> No<input name="health_safe" value="N" type="radio" /></td>
<td></td>
<td><textarea name="health_safe_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the property secured?</th>
<td>Yes<input name="prop_secure" value="Y" type="radio" /> No<input name="prop_secure" value="N" type="radio" /></td>
<td></td>
<td><textarea name="prop_secure_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the landscaping maintained?</th>
<td>Yes<input name="land_main" value="Y" type="radio" />No<input name="land_main" value="N" type="radio" /></td>
<td></td>
<td><textarea name="land_main_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the interior of the property clean?</th>
<td>Yes<input name="int_clean" value="Y" type="radio" /> No<input name="int_clean" value="N" type="radio" /></td>
<td></td>
<td><textarea name="int_clean_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the electricity turned on?</th>
<td>Yes<input name="electricity" value="Y" type="radio" /> No<input name="electricity" value="N" type="radio" /></td>
<td></td>
<td><textarea name="electricity_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>Is the water turned on?</th>
<td>Yes<input name="water" value="Y" type="radio" /> No<input name="water" value="N" type="radio" /></td>
<td></td>
<td><textarea name="water_comm" rows="2" cols="40"></textarea></td>
</tr>
<tr>
<th>If between September and April, are there notices that the home has been winterized? (please provide photos of notices)?</th>
<td>Yes<input name="winterized" value="Y" type="radio" /> No<input name="winterized" value="N" type="radio" />N/A<input name="winterized" value="na" type="radio" /></td>
<td></td>
<td><textarea name="winterized_comm" rows="2" cols="40"></textarea></td>
</tr>
</tbody>
</table><br />
<table>
<tbody>
<tr>
<th>Please provide any additional comments, such as, condition of neighboring homes, current real estate market conditions in the area.</th>
</tr>
<tr>
<td><textarea name="add_comm" rows="10" cols="111"></textarea></td>
</tr>
</tbody>
</table><br />

<table>
 <tbody>
  <tr>
   <th>IMAGE HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center>SUBJECT FRONT</center></th>
       </tr>
        <td><input type="file" id="upload_front" name="upload_front" /></td>
     </table>
    </td>
   </tr>
   <tr>
<th>IMAGE 2 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center>
        <?php
         require_once('connvars.php');
         //drop down for image 2 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id2 = $row['location_id'];
           $location_name2 = $row['location_name'];
           echo "<option value=\"$location_id2\">$location_name2</option>\n";
          }
          echo"</select>\n";
        ?>
     </center></th>
      </tr>
       <td><input type="file" id="upload_2" name="upload_2" /></td>
      </tr>
    </table>
   </td>
 </tr>

<th>IMAGE 3 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center>
<?php
         require_once('connvars.php');
         //drop down for image 3 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id3 = $row['location_id'];
           $location_name3 = $row['location_name'];
           echo "<option value=\"$location_id3\">$location_name3</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
      </tr>
       <td><input type="file" id="upload_3" name="upload_3" /></td>
      </tr>
   </table>
</td>
</tr>

   <th>IMAGE 4 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 4 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id4 = $row['location_id'];
           $location_name4 = $row['location_name'];
           echo "<option value=\"$location_id4\">$location_name4</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_4" name="upload_4" /></td>
      </tr>
     </table>
    </td>
   </tr>
    
<th>IMAGE 5 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 5 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id5 = $row['location_id'];
           $location_name5 = $row['location_name'];
           echo "<option value=\"$location_id5\">$location_name5</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_5" name="upload_5" /></td>
      </tr>
     </table>
    </td>
   </tr>

<th>IMAGE 6 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center><?php
         require_once('connvars.php');
         //drop down for image 6 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id6 = $row['location_id'];
           $location_name6 = $row['location_name'];
           echo "<option value=\"$location_id6\">$location_name6</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
      </tr>
       <td><input type="file" id="upload_6" name="upload_6" /></td>
      </tr>
</table>
</td>
</tr>

   <th>IMAGE 7 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 7 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id7 = $row['location_id'];
           $location_name7 = $row['location_name'];
           echo "<option value=\"$location_id7\">$location_name7</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_7" name="upload_7" /></td>
     </table>
    </td>
   </tr>


   <th>IMAGE 8 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 8 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id8 = $row['location_id'];
           $location_name8 = $row['location_name'];
           echo "<option value=\"$location_id8\">$location_name8</option>\n";
          }
          echo"</select>\n";
        ?>
</center></th>
       </tr>
        <td><input type="file" id="upload_8" name="upload_8" /></td>
      </tr>
     </table>
    </td>
   </tr>
    
<th>IMAGE 9 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 9 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id9 = $row['location_id'];
           $location_name9 = $row['location_name'];
           echo "<option value=\"$location_id9\">$location_name9</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_9" name="upload_9" /></td>
      </tr>
     </table>
    </td>
   </tr>

<th>IMAGE 10 HERE</th>
   <td>
    <table>
     <tbody>
      <tr>
       <th><center><?php
         require_once('connvars.php');
         //drop down for image 10 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id10 = $row['location_id'];
           $location_name10 = $row['location_name'];
           echo "<option value=\"$location_id10\">$location_name10</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
      </tr>
       <td><input type="file" id="upload_10" name="upload_10" /></td>
      </tr>
</table>
</td>
</tr>

   <th>IMAGE 11 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 11 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id11 = $row['location_id'];
           $location_name11 = $row['location_name'];
           echo "<option value=\"$location_id11\">$location_name11</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_11" name="upload_11" /></td>
     </table>
    </td>
   </tr>

<th>IMAGE 12 HERE</th>
    <td>
     <table>
      <tbody>
       <tr>
        <th><center><?php
         require_once('connvars.php');
         //drop down for image 12 
         $dbc=mysqli_connect(db_host,db_user,db_password,db_name)or die('Error connecting to MySQL server.');
         $dd_loc="select location_id, location_name from location_type order by location_name ASC";
         $dd_loc_result=mysqli_query($dbc,$dd_loc);
          echo "<select name=\"location_id\">\n"; 
          echo "<option value=\"NULL\">Select Image Location</option>\n";
           while($row = mysqli_fetch_array($dd_loc_result)){
           $location_id12 = $row['location_id'];
           $location_name12 = $row['location_name'];
           echo "<option value=\"$location_id12\">$location_name12</option>\n";
          }
          echo"</select>\n";
        ?></center></th>
       </tr>
        <td><input type="file" id="upload_12" name="upload_12" /></td>
     </table>
    </td>
   </tr>
    </table>
   </td>
 </tbody>
</table><br />


Agent Name: <input name="agent_name" type="text" /> Date Inspection Completed:  <input name="completed_date" type="date" />
<p>&nbsp;</p>
<input value="Submit Data" name="submit" type="submit" />
<input value="Produce PDF" name="propinsppdf" type="button" onClick="window.open('<?php echo urlencode(urlencode('prop_insp_pdf.php?prop_addr_1=' . $prop_addr_1)); ?>')" /></p><br />


</form>
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ludwig DiehlSystems ArchitectCommented:
do you only want to populate "listing_agent" text field?
0
rcowen00Author Commented:
Thanks for your response ludwiqDiehl but hielo figured my issue.  I did have to edit the mysql to mysqli and work through some functions requiring 2 parameters (ie $dbc also), but it is working.  Thank you heilo!
0
Ludwig DiehlSystems ArchitectCommented:
Tell me if I am wrong what you need is the user fills in an empty form if job_id is not provided and if job_id is set then data is retrieved from db right?.
Bu if data is retrieved from db then if the user clicks "Submit Data", form values are inserted as a new record?
Another thing. You are updating the job table, but if no value for job_id is provided then no record is updated, is that what u actually want?.
Could you please explain in few words what the workflows is? Thank you
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.