Jump to content

php use get function in form


ericjw316

Recommended Posts

I would like to thank everyone helping me on my previous question. This is the last question i have. Currently i have my program running but i just need to figure out how to use the get function on check boxes and text boxes.

 

Here is the code i am using for the php mysql part of it.

<?php
$con=mysqli_connect("localhost","username","password","dbase");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql="SELECT * from table where id = '".$_GET["id"]."' ";
$rs=mysql_query($sql,$conn) or die(mysql_error());
?>

I know this is working by echoing what i needed to display. But i am in a situation where the form is extremely large and i need to display it in the what it is setup currently.

 

Here is an example of the form

<form name="standard" method="post" action="submit.php">
<table width="100%" height="1295" border="0" cellspacing="0" cellpadding="0">
<tr>
  <td valign="top"  background="../test report page/images/test form standard large2.jpg" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="35" height="122"> </td>
      <td width="920"> </td>
      <td width="45"> </td>
    </tr>
    <tr>
      <td height="49"> </td>
      <td valign="top"><table width="100%" height="44" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="25%" valign="bottom"> <input name="water-purveyor" type="text" id="water-purveyor" size="25" height="25" value="<?php echo'.$result["water-purveyor"].' ?>" /></td>
          <td width="20%" valign="bottom"> <input type="text" name="facility-contact" id="facility-contact" height="25" value="<?php echo'.$result["facility-contact"].' ?>" /></td>
          <td width="55%" valign="bottom"><input type="text" name="facility-address" id="facility-address" size="50" height="25" value="<?php echo'.$result["facility-address"].' ?>" /></td>
        </tr>
      </table></td>
      <td> </td>
    </tr>
  <tr>
          <td width="28%" height="85" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td colspan="2" rowspan="2"> </td>
              <td width="15%" height="33"><input type="checkbox" name="v1-na" id="v1-na" value="<?php echo'.$result["v1-na"].' ?>" /></td>
              <td width="14%"><input type="checkbox" name="v1-good" id="v1-good" value="<?php echo'.$result["v1-good"].' ?>" /></td>
              <td width="15%"><input type="checkbox" name="v1-poor" id="v1-poor" value="<?php echo'.$result["v1-poor"].' ?>" /></td>
              <td width="15%"><input type="checkbox" name="v1-fail" id="v1-fail" value="<?php echo'.$result["v1-fail"].' ?>" /></td>
            </tr>
            <tr>
              <td height="35" valign="top" style="padding-top:4px;"><input type="checkbox" name="v2-na" id="v2-na" value="<?php echo'.$result["v2-na"].' ?>" /></td>
              <td valign="top" style="padding-top:4px;"><input type="checkbox" name="v2-good" id="v2-good" value="<?php echo'.$result["v2-good"].' ?>" /></td>
              <td valign="top" style="padding-top:4px;"><input type="checkbox" name="v2-poor" id="v2-poor" value="<?php echo'.$result["v2-poor"].' ?>" /></td>
              <td valign="top" style="padding-top:4px;"><input type="checkbox" name="v2-fail" id="v2-fail" value="<?php echo'.$result["v2-fail"].' ?>" /></td>
            </tr>
          </table>
</form>

Can you tell me if this will work or can you give me some helpful ways to make this work.

 

Again thank you for all your help. E

Link to comment
Share on other sites

"Get function"? And for two, your form is using POST and not GET.

 

Those textboxes and checkboxes have names, right? Like "water-purveyor" and "v1-na". So those will be in $_POST - though checkboxes only if the user checked them, so you need isset() for those.

$water_purveyor = $_POST["water-purveyor"];
$v1_na = (isset($_POST["v1-na"]) ? $_POST["v1-na"] : /* default value? */ null);
Link to comment
Share on other sites

To answer your question the form i showed was my get area.  The posting of the form is working just fine.  If i can use post i can change that.  What i need to know is the echo for the text boxes and for the check boxes to display the data in the form.  I have the posting done to where i have the data in the database done.  So if the check box is set to 1 or 0 like this in my sending info to the database

$v1-na = isset($_POST['v1-na']) ? 1 : 0; 

If the isset is used how can i set it to have the check box check or unchecked?  1 is checked 0 is unchecked.

Link to comment
Share on other sites

How can you make the checkbox be checked for the user? Put a "checked" in the HTML if you want it checked.

 

There's something funky happening with your code in that form, so I'm going to go out on a limb and fix it.

 />
The value doesn't really matter, and instead it uses the value in $result to show the "checked" or not.
  • Like 1
Link to comment
Share on other sites

To answer your question the form i showed was my get area

 

 

the reference the OP is using to 'get', is likely referring to his get method code, i.e. the code that's responsible for displaying the page due to a get request (or a post request with validation errors and a need to redisplay the form.)

 

But i am in a situation where the form is extremely large....

 

this is about the n'th recent - I have this huge hard-coded form and I need to populate/repopulate the form fields with existing database data/data from the last form submission.

 

if you have a form more than about 3 form fields, you need to use php to DYNAMICALLY produce the form (produce the form field, display any validation errors, populate the field with existing data) and DYNAMICALLY process the submitted form data.

 

for an example showing how to do this, see my posts in the following thread - http://forums.phpfreaks.com/topic/298936-form-data-to-csv-using-php-code-problems/

 

to populate the form fields with either existing database data or data from the last form submission, see the use of the $data array in that example code and the comment in the code - // get request code would go here... if you are retrieving data to edit/update it, if the $data array doesn't exist at this point, the form hasn't been submitted. retrieve any existing data and store it in the $data array. at the point of populating/repopulating the form fields, you would just use the data values in the $data array.

 

to populate/repopulate checkboxs, you have to output a checked attribute in the <input type='checkbox' ... checked> tag. dynamically producing the form makes this easy, because as your code is looping and producing the form fields, for a checkbox type, you would just test if the existing data for that checkbox matches the current checkbox you are producing, and output the checked attribute at the correct place. using this method, you don't have to write out the program logic for every form field. you only have to write the correct logic one time, for each different type of form field.

Link to comment
Share on other sites

Hey i have tried to do the code and i am not getting a return of data.  here is the form and mysql.  Can you let me know what i am doing wrong or just point me in the right direction.

  
    <form name="form1" method="post" action="">
    <?php
$con=mysqli_connect("localhost","username","password","database");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

$water_purveyor = $_POST['water_purveyor'];  $meter_num = $_POST['meter_num'];  $permit_num = $_POST['permit_num'];  $manufacturer = $_POST['manufacturer'];  $meter_size = $_POST['meter_size'];   $model_num = $_POST['model_num'];  $serial_num = $_POST['serial_num'];  $mc_name = $_POST['mc_name'];  $mc_contact = $_POST['mc_contact'];  $mc_phone_num = $_POST['mc_phone_num'];  $mc_address = $_POST['mc_address'];  $mc_city = $_POST['mc_city'];  $mc_state = $_POST['mc_state'];  $mc_zip = $_POST['mc_zip'];  $oi_name = $_POST['oi_name'];  $oi_contact = $_POST['oi_contact'];  $oi_phone = $_POST['oi_phone'];  $oi_address = $_POST['oi_address'];  $oi_city = $_POST['oi_city'];  $oi_state = $_POST['oi_state'];  $oi_zip = $_POST['oi_zip'];  $bf_assembly_address = $_POST['bf_assembly_address'];  $primary_business = $_POST['primary_business'];  $onsite_location = $_POST['onsite_location'];  $new_serial_num = $_POST['new_serial_num'];  $toa_other_text = $_POST['toa_other_text'];  $line_pressuer = $_POST['line_pressuer'];  $svb_aioa_psid = $_POST['svb_aioa_psid'];  $cv1_psid = $_POST['cv1_psid'];  $cv2_psid = $_POST['cv2_psid'];  $dprv_psid = $_POST['dprv_psid'];  $svb_cvha_psid = $_POST['svb_cvha_psid'];  $shut_off_valve = $_POST['shut_off_valve'];  $ft_cv1_psid = $_POST['ft_cv1_psid'];  $ft_cv2_psid = $_POST['ft_cv2_psid'];  $ft_dprv_psid = $_POST['ft_dprv_psid'];  $ft_ai_psid = $_POST['ft_ai_psid'];  $ft_cv_psid = $_POST['ft_cv_psid'];  $itb = $_POST['itb'];  $certified_tester_num = $_POST['certified_tester_num'];  $date_failed = $_POST['date_failed'];  $tk_serial_num = $_POST['tk_serial_num'];  $repaired_by = $_POST['repaired_by'];  $cert_num = $_POST['cert_num'];  $repair_date = $_POST['repair_date'];  $ftb = $_POST['ftb'];  $ftb_certified_tester_num = $_POST['ftb_certified_tester_num'];  $date_passed = $_POST['date_passed'];  $ftb_tk_serial_num = $_POST['ftb_tk_serial_num'];  $comments = $_POST['comments'];

	$table = "table";

    $sql = "SELECT * FROM $table WHERE id = :id";
?>

    <table width="1100" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td  width="1100" height="1550" style="background-image:url(../test%20report%20page/images/city%20of%20phx%20Test%20report%20large.jpg); background-repeat:no-repeat; width:1100px; height:1550px;" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="62" height="204"> </td>
          <td width="961"> </td>
          <td width="77"> </td>
        </tr>
        <tr>
          <td height="37"> </td>
          <td valign="bottom"><table width="100%" height="40" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="335" height="40" align="right"><div style="padding_left:110px; padding_bottom:5px;"><?php echo $water_purveyor ?></div></td>
              <td width="295" align="right"><div style="padding_bottom:5px;"><?php echo $meter_num ?></div></td>
              <td width="249" align="right"><div style="padding_bottom:5px;"><?php echo $permit_num ?></div></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="37"> </td>
          <td valign="bottom"><table width="100%" height="34" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="38%" height="34" align="right"><?php echo $manufacturer ?></td>
              <td width="17%" align="right"><?php echo $meter_size ?></td>
              <td width="17%" align="right"><?php echo $model_num ?></td>
              <td width="28%" align="right"><?php echo $serial_num ?></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="43"> </td>
          <td valign="bottom"><table width="100%" height="33" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="56%"><?php echo $mc_name ?></td>
              <td width="28%"><?php echo $mc_contact ?></td>
              <td width="16%"><?php echo $mc_phone_num ?></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="41"> </td>
          <td valign="bottom"><table width="100%" height="33" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="68%"><?php echo $mc_address ?></td>
              <td width="13%"><?php echo $mc_city ?></td>
              <td width="7%"><?php echo $mc_state ?></td>
              <td width="12%"><?php echo $mc_zip ?></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="43"> </td>
          <td valign="bottom"><table width="100%" height="33" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="56%"><?php echo $oi_name ?></td>
              <td width="28%"><?php echo $oi_contact ?></td>
              <td width="16%"><?php echo $oi_phone ?></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="37"> </td>
          <td><table width="100%" height="33" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="68%" align="right"><div style="padding_right:15px;"><?php echo $oi_address ?></div></td>
              <td width="12%" valign="bottom">  <?php echo $oi_city ?></td>
              <td width="7%" valign="bottom"><?php echo $oi_state ?></td>
              <td width="13%" valign="bottom"><?php echo $oi_zip ?></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="40"> </td>
          <td valign="bottom"><table width="100%" height="33" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="68%" align="right"> <div style="padding_right:15px;"><?php echo $bf_assembly_address ?></div></td>
              <td width="32%" valign="bottom"><?php echo $primary_business ?></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="56"> </td>
          <td valign="bottom"><table width="100%" height="59" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="64%" height="59" align="right"><div style="padding_right:10px;"><?php echo $onsite_location ?></div></td>
              <td width="36%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td colspan="2"> </td>
                  <td width="16%" valign="top"><input type="checkbox" name="new_assembly_yes" id="new_assembly_yes" /></td>
                  <td width="18%"><input type="checkbox" name="new_assembly_no" id="new_assembly_no" /></td>
                </tr>
                <tr>
                  <td colspan="2"> </td>
                  <td valign="top"><input type="checkbox" name="replacement_assembly_yes" id="replacement_assembly_yes" /></td>
                  <td><input type="checkbox" name="replacement_assembly_no" id="replacement_assembly_no" /></td>
                </tr>
                <tr>
                  <td width="37%"> </td>
                  <td colspan="3"><?php echo $new_serial_num ?></td>
                  </tr>
              </table></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="48"> </td>
          <td valign="top"><table width="100%" height="42" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="51%" height="33"><table width="100%" height="32" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="19%"> </td>
                  <td width="40%"><input type="checkbox" name="poa_secondary" id="poa_secondary" /></td>
                  <td width="41%"><input type="checkbox" name="poa_primary" id="poa_primary" /></td>
                </tr>
              </table></td>
              <td width="49%"><table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="8%"> </td>
                  <td width="25%"><input type="checkbox" name="poa_fire_system" id="poa_fire_system" /></td>
                  <td width="23%"><input type="checkbox" name="poa_landscape" id="poa_landscape" /></td>
                  <td width="44%"><input type="checkbox" name="poa_portable" id="poa_portable" /></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="53"> </td>
          <td><table width="100%" height="49" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="62%"><table width="100%" height="48" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="6%"> </td>
                  <td width="23%"> </td>
                  <td width="12%"><input type="checkbox" name="svb" id="svb" /></td>
                  <td width="11%"><input type="checkbox" name="pvb" id="pvb" /></td>
                  <td width="11%"><input type="checkbox" name="dc" id="dc" /></td>
                  <td width="37%"><input type="checkbox" name="rp" id="rp" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td valign="bottom"><input type="checkbox" name="toa_other" id="toa_other" /></td>
                  <td colspan="4"><?php echo $toa_other_text ?></td>
                  </tr>
              </table></td>
              <td width="14%"><div style="padding_left:15px; padding_top:15px;"><?php echo $line_pressure ?></div></td>
              <td width="24%" valign="top"><table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="50%"> </td>
                  <td width="26%"><input type="checkbox" name="bp_yes" id="bp_yes" /></td>
                  <td width="24%"><input type="checkbox" name="bp_no" id="bp_no" /></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="66"> </td>
          <td valign="bottom"><table width="100%" height="50" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="79%"> </td>
              <td width="21%" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td colspan="3" align="center"><?php echo $svb_aioa_psid ?></td>
                  <td width="24%"> </td>
                </tr>
                <tr>
                  <td width="25%"> </td>
                  <td width="22%"> </td>
                  <td width="29%"><input type="checkbox" name="svb_leaked_yes" id="svb_leaked_yes" /></td>
                  <td><input type="checkbox" name="svb_leaked_no" id="svb_leaked_no" /></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="67"> </td>
          <td valign="bottom"><table width="100%" height="65" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="10%"> </td>
              <td width="24%"><table width="100%" height="65" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="20%"> </td>
                  <td width="14%"> </td>
                  <td width="24%"> </td>
                  <td width="13%"><input type="checkbox" name="cv1_ct_yes" id="cv1_ct_yes" /></td>
                  <td width="10%"> </td>
                  <td width="19%"><input type="checkbox" name="cv1_ct_no" id="cv1_ct_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td colspan="3" align="center"><?php echo $cv1_psid ?></td>
                  <td> </td>
                  <td> </td>
                </tr>
                <tr>
                  <td> </td>
                  <td> </td>
                  <td> </td>
                  <td><input type="checkbox" name="cv1_leaked_yes" id="cv1_leaked_yes" /></td>
                  <td> </td>
                  <td><input type="checkbox" name="cv1_leaked_no" id="cv1_leaked_no" /></td>
                </tr>
              </table></td>
              <td width="24%"><table width="100%" height="65" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="16%"> </td>
                  <td width="16%"> </td>
                  <td width="24%"> </td>
                  <td width="13%"><input type="checkbox" name="cv2_ct_yes" id="cv2_ct_yes" /></td>
                  <td width="10%"> </td>
                  <td width="21%"><input type="checkbox" name="cv2_ct_no" id="cv2_ct_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td colspan="3" align="center"><?php echo $cv2_psid ?></td>
                  <td> </td>
                  <td> </td>
                </tr>
                <tr>
                  <td> </td>
                  <td> </td>
                  <td> </td>
                  <td><input type="checkbox" name="cv2_leaked_yes" id="cv2_leaked_yes" /></td>
                  <td> </td>
                  <td><input type="checkbox" name="cv2_leaked_no" id="cv2_leaked_no" /></td>
                </tr>
              </table></td>
              <td width="21%"><table width="100%" height="54" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="17%" height="34"> </td>
                  <td colspan="2" valign="bottom" align="center"><?php echo $dprv_psid ?></td>
                  <td width="6%"> </td>
                  <td width="20%"> </td>
                </tr>
                <tr>
                  <td> </td>
                  <td width="38%"> </td>
                  <td width="19%"><input type="checkbox" name="dprv_dno_yes" id="dprv_dno_yes" /></td>
                  <td> </td>
                  <td><input type="checkbox" name="dprv_dno_no" id="dprv_dno_no" /></td>
                </tr>
              </table></td>
              <td width="21%" valign="bottom"><table width="100%" height="55" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td colspan="3" align="center"><div style="padding_top:5px;"><?php echo $svb_cvha_psid ?></div></td>
                  <td width="23%"> </td>
                </tr>
                <tr>
                  <td width="25%"> </td>
                  <td width="25%"> </td>
                  <td width="27%"><input type="checkbox" name="svb_cvha_leaked_yes" id="svb_cvha_leaked_yes" /></td>
                  <td><input type="checkbox" name="svb_cvha_leaked_no" id="svb_cvha_leaked_no" /></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="135"> </td>
          <td valign="bottom"><table width="100%" height="135" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="10%"> </td>
              <td width="24%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="58%"> </td>
                  <td width="23%"><input type="checkbox" name="cv1_cleaned_yes" id="cv1_cleaned_yes" /></td>
                  <td width="19%"><input type="checkbox" name="cv1_cleaned_no" id="cv1_cleaned_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td valign="top"><input type="checkbox" name="cv1_replaced_yes" id="cv1_replaced_yes" /></td>
                  <td valign="top"><input type="checkbox" name="cv1_replaced_no" id="cv1_replaced_no" /></td>
                </tr>
                
                <tr>
                  <td height="30"> </td>
                  <td valign="bottom"><input type="checkbox" name="cv1_rkd_yes" id="cv1_rkd_yes" /></td>
                  <td valign="bottom"><input type="checkbox" name="cv1_rkd_no" id="cv1_rkd_no" /></td>
                </tr>
                <tr>
                  <td height="10"> </td>
                  <td><input type="checkbox" name="cv1_springs_yes" id="cv1_springs_yes" /></td>
                  <td><input type="checkbox" name="cv1_springs_no" id="cv1_springs_no" /></td>
                </tr>
                <tr>
                  <td height="10"> </td>
                  <td><input type="checkbox" name="cv1_guide_yes" id="cv1_guide_yes" /></td>
                  <td><input type="checkbox" name="cv1_guide_no" id="cv1_guide_no" /></td>
                </tr>
                <tr>
                  <td height="10"> </td>
                  <td valign="top"><input type="checkbox" name="cv1_other_yes" id="cv1_other_yes" /></td>
                  <td valign="top"><input type="checkbox" name="cv1_other_no" id="cv1_other_no" /></td>
                </tr>
              </table></td>
              <td width="24%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="55%"> </td>
                  <td width="25%"><input type="checkbox" name="cv2_cleaned_yes" id="cv2_cleaned_yes" /></td>
                  <td width="20%"><input type="checkbox" name="cv2_cleaned_no" id="cv2_cleaned_no" /></td>
                </tr>
                <tr>
                  <td height="10"> </td>
                  <td><input type="checkbox" name="cv2_replaced_yes" id="cv2_replaced_yes" /></td>
                  <td><input type="checkbox" name="cv2_replaced_no" id="cv2_replaced_no" /></td>
                </tr>
                
                <tr>
                  <td height="30"> </td>
                  <td valign="bottom"><input type="checkbox" name="cv2_rkd_yes" id="cv2_rkd_yes" /></td>
                  <td valign="bottom"><input type="checkbox" name="cv2_rkd_no" id="cv2_rkd_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="cv2_springs_yes" id="cv2_springs_yes" /></td>
                  <td><input type="checkbox" name="cv2_springs_no" id="cv2_springs_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="cv2_guide_yes" id="cv2_guide_yes" /></td>
                  <td><input type="checkbox" name="cv2_guide_no" id="cv2_guide_no" /></td>
                </tr>
                <tr>
                  <td height="10"> </td>
                  <td valign="top"><input type="checkbox" name="cv2_other_yes" id="cv2_other_yes" /></td>
                  <td valign="top"><input type="checkbox" name="cv2_other_no" id="cv2_other_no" /></td>
                </tr>
              </table></td>
              <td width="21%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="54%"> </td>
                  <td width="27%"><input type="checkbox" name="dprv_cleaned_yes" id="dprv_cleaned_yes" /></td>
                  <td width="19%"><input type="checkbox" name="dprv_cleaned_no" id="dprv_cleaned_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="dprv_replaced_yes" id="dprv_replaced_yes" /></td>
                  <td><input type="checkbox" name="dprv_replaced_no" id="dprv_replaced_no" /></td>
                </tr>
                
                <tr>
                  <td height="30"> </td>
                  <td valign="bottom"><input type="checkbox" name="dprv_rkd_yes" id="dprv_rkd_yes" /></td>
                  <td valign="bottom"><input type="checkbox" name="dprv_rkd_no" id="dprv_rkd_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="dprv_springs_yes" id="dprv_springs_yes" /></td>
                  <td><input type="checkbox" name="dprv_springs_no" id="dprv_springs_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="dprv_guide_yes" id="dprv_guide_yes" /></td>
                  <td><input type="checkbox" name="dprv_guide_no" id="dprv_guide_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="dprv_other_yes" id="dprv_other_yes" /></td>
                  <td><input type="checkbox" name="dprv_other_no" id="dprv_other_no" /></td>
                </tr>
              </table></td>
              <td width="21%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="50%"> </td>
                  <td width="27%"><input type="checkbox" name="pvb_cleaned_yes" id="pvb_cleaned_yes" /></td>
                  <td width="23%"><input type="checkbox" name="pvb_cleaned_no" id="pvb_cleaned_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="pvb_replaced_yes" id="pvb_replaced_yes" /></td>
                  <td><input type="checkbox" name="pvb_replaced_no" id="pvb_replaced_no" /></td>
                </tr>
                
                <tr>
                  <td height="30"> </td>
                  <td valign="bottom"><input type="checkbox" name="pvb_rkd_yes" id="pvb_rkd_yes" /></td>
                  <td valign="bottom"><input type="checkbox" name="pvb_rkd_no" id="pvb_rkd_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="pvb_springs_yes" id="pvb_springs_yes" /></td>
                  <td><input type="checkbox" name="pvb_springs_no" id="pvb_springs_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td><input type="checkbox" name="pvb_guide_yes" id="pvb_guide_yes" /></td>
                  <td><input type="checkbox" name="pvb_guide_no" id="pvb_guide_no" /></td>
                </tr>
                <tr>
                  <td> </td>
                  <td valign="top"><input type="checkbox" name="pvb_other_yes" id="pvb_other_yes" /></td>
                  <td valign="top"><input type="checkbox" name="pvb_other_no" id="pvb_other_no" /></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="35"> </td>
          <td><table width="100%" height="30" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="11%"> </td>
              <td width="89%" valign="top"><table width="100%" height="25" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="35%"> </td>
                  <td width="10%" valign="top">  <?php echo $shut_off_valve ?></td>
                  <td width="13%"><input type="checkbox" name="repaired" id="repaired" /></td>
                  <td width="13%"><input type="checkbox" name="replaced" id="replaced" /></td>
                  <td width="29%"><input type="checkbox" name="both_ok" id="both_ok" /></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="64"> </td>
          <td><table width="100%" height="63" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="10%"> </td>
              <td width="24%"><table width="100%" height="63" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="20%" height="20" headers="14"> </td>
                  <td width="38%"> </td>
                  <td width="14%" valign="top"><input type="checkbox" name="ft_cv1_ct_yes" id="ft_cv1_ct_yes" /></td>
                  <td width="9%"> </td>
                  <td width="19%" valign="top"><input type="checkbox" name="ft_cv1_ct_no" id="ft_cv1_ct_no" /></td>
                </tr>
                <tr>
                  <td height="40"> </td>
                  <td colspan="2" align="center" valign="top"><?php echo $ft_cv1_psid ?></td>
                  <td> </td>
                  <td> </td>
                </tr>
              </table></td>
              <td width="24%"><table width="100%" height="63" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="20%" height="20" headers="14"> </td>
                  <td width="36%"> </td>
                  <td width="14%" valign="top"><input type="checkbox" name="ft_cv2_ct_yes2" id="ft_cv2_ct_yes2" /></td>
                  <td width="10%"> </td>
                  <td width="20%" valign="top"><input type="checkbox" name="ft_cv_ct_no" id="ft_cv2_ct_no" /></td>
                </tr>
                <tr>
                  <td height="40"> </td>
                  <td colspan="2" align="center" valign="top"><?php echo $ft_cv2_psid ?></td>
                  <td> </td>
                  <td><input type="checkbox" name="ft_cv2_ct_yes" id="ft_cv2_ct_yes" /></td>
                </tr>
              </table></td>
              <td width="21%" align="center"><?php echo $ft_dprv_psid ?></td>
              <td width="21%" valign="top"><table width="100%" height="57" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td width="42%" height="25"> </td>
                  <td colspan="2"><?php echo $ft_ai_psid ?></td>
                  <td width="17%"> </td>
                </tr>
                <tr>
                  <td> </td>
                  <td width="15%"> </td>
                  <td width="26%"><?php echo $ft_cv_psid ?></td>
                  <td> </td>
                </tr>
              </table></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="48"> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td height="43"> </td>
          <td valign="bottom"><table width="100%" height="42" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="50%"><div style="padding_top:8px;"><?php echo $itb ?></div></td>
              <td width="22%"><div style="padding_top:8px;"><?php echo $certified_tester_num ?></div></td>
              <td width="13%"><div style="padding_top:8px;"><?php echo $date_failed ?></div></td>
              <td width="15%"><div style="padding_top:8px;"><?php echo $tk_serial_num ?></div></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="36"> </td>
          <td valign="bottom"><table width="100%" height="31" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="50%" valign="bottom"><?php echo $repaired_by ?></td>
              <td width="35%" valign="bottom"><?php echo $cert_num ?></td>
              <td width="15%" valign="bottom"><?php echo $repair_date ?></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="45"> </td>
          <td valign="bottom"><table width="100%" height="36" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="50%"><div style="padding_top:8px;"><?php echo $ftb ?></div></td>
              <td width="22%"><div style="padding_top:8px;"><?php echo $ftb_certified_tester_num ?></div></td>
              <td width="14%"><div style="padding_top:8px;"><?php echo $date_passed ?></div></td>
              <td width="14%"><div style="padding_top:8px;"><?php echo $ftb_tk_serial_num ?></div></td>
            </tr>
          </table></td>
          <td> </td>
        </tr>
        <tr>
          <td height="156"> </td>
          <td valign="bottom"><?php echo $comments ?></td>
          <td> </td>
        </tr>
        <tr>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td> </td>
    </tr>
    <tr>
      <td> </td>
    </tr>
    <tr>
      <td> </td>
    </tr>
    <tr>
      <td align="center"></td>
    </tr>
  </table>

<?php
if (!mysql_query($sql,$con))

  {

  die('Error: ' . mysql_error());

  }

mysql_close($con)
?>
</form>
Link to comment
Share on other sites

i was going to try and provide some specific direction that would help you, but your code seems to be pretty much just a random, changing, collection of things you have seen somewhere. that you now have the code that's running the sql query statement, which isn't even using the same database api as your connection code, and no code to fetch the result from the query, after the form that's trying to use the data, shows that you either aren't looking at what you are doing or you have no idea what the statements mean.

 

so, my only recommendation is - in order for you to retrieve YOUR data from a database or to process the data submitted from YOUR form, you will first have to learn how to do these tasks at all. you need to learn and practice the basics first, before you can do this for your data and your form. you would start by getting the entire process to work correctly for one instance of a form field type.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.