Jump to content

Something other than the standard form


crmamx

Recommended Posts

This is the simplest of forms, but it has no character. It is the type I use in everything.

 

form1.php

<html>
<head>
</head>
<body>
<?php
// Connect to database=====================================================

include("connect_db.php"); 

// retrieve form data ======================================================

$id = $_POST['id']; 

// sending query ===========================================================

$query = "SELECT ama,model_name,model_mfg,wingspan,engine,decibels FROM airplanes WHERE id='$id'";
if( !$result = mysql_query($query) ) {
    echo "<br>Query $query<br>Failed with error: " . mysql_error() . '<br>';
} else {
    $fetch = mysql_fetch_array( $result );
}


// $fetch = mysql_fetch_array(mysql_query("SELECT ama,model_name,model_mfg,wingspan,engine,decibels FROM airplanes
// WHERE id='$id'"));

// Output form with retrieved data ==========================================
?>
<h3>Change the data and then click the CHANGE button</h3><br>
<form name="myForm" action="delete_airplanes.php" onsubmit="return validateForm()" method="post">
ID #:<input type="text" name="id" value="<?=$fetch[id]?>" /><br>
AMA #:<input type="text" name="ama" value="<?=$fetch[ama]?>" /><br>
Model Name:<input type="text" name="model_name" value="<?=$fetch[model_name]?>" /><br>
Model Mfg:<input type="text" name="model_mfg" value="<?=$fetch[model_mfg]?>" /><br>
Wingspan:<input type="text" name="wingspan" value="<?=$fetch[wingspan]?>" /><br>
Engine:<input type="text" name="engine" value="<?=$fetch[engine]?>" /><br>
Decibels:<input type="text" name="decibels" value="<?=$fetch[decibels]?>" /><br><br>
<input name="submit" id="submit" value="CHANGE!" type="submit">
    
</form>

<br>
<body>
</html>

 

I would love to be able to get this form to work.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Enter Airplane Data</title>
  <meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
  <meta name="language" content="en" />
  <style type="text/css">
.focus { background: #FEF1C1; }
.class123-label { font-family: Verdana; font-size: small; }
.class123-sidebyside { float:left; margin:0 5px 0 0;}
.class123-twocol { float:left; width:45%; margin:0 5px 0 0;}
.class123-threecol { float:left; width:30%; margin:0 5px 0 0;}
.class123-likert_style_li { display:inline-block; vertical-align:middle; text-align:center; top:0px; padding:2px; width:64px; height:50px; margin:0px; margin-right:1px; margin-bottom:1px; font:11px/18px verdana; background:#ddd; zoom:1; *display:inline; }
.class123-likert_style_li2 { display:inline-block; vertical-align:middle; text-align:center; top:0px; padding:2px; width:64px; height:50px; margin:0px; margin-right:1px; margin-bottom:0px; font:12px/18px verdana; background:#fff; zoom:1; *display:inline; border-top:1px solid #ddd; }
.fontbold { font-weight: bold; }
.fontitalic { font-style: italic; }
.requiredspan { font-family: Verdana; font-size:10px; color:#f00; } </style>
</head>
<body style="background-color: rgb(138, 174, 222); direction: ltr;">
<div style="height: 50px;"> </div>
<center>
<table style="border-collapse: collapse;" id="AutoNumber1"
border="0" cellpadding="0" cellspacing="0"
width="658">
  <tbody>
    <tr>
      <td class="tdborder" colspan="3" width="658">
      <img alt="shadow" class="tdimagesus"
src="/templates/cache/dynamicimage-1-1560BD.png" height="9"
width="100%" /> </td>
    </tr>
    <tr>
      <td height="38" width="4"> </td>
      <td class="tdheader"
style="border-style: solid solid none; border-color: rgb(1, 76, 169) rgb(1, 76, 169) -moz-use-text-color; border-width: thin thin medium;"
bgcolor="#1560bd" height="38" width="650"> <img
alt="logo"
src="http://www.123contactform.com/templates/logos/computers_anvelope_white.png"
align="left" /> </td>
      <td height="38" width="4"> </td>
    </tr>
    <tr>
      <td height="171" width="4"> </td>
      <td class="tdmain"
style="border-style: none solid; border-color: -moz-use-text-color rgb(1, 76, 169); border-width: medium thin; padding-right: 10px;"
bgcolor="#ffffff" height="171" width="650">
      <div class="selector-off">
      <center>
      <script type="text/javascript">
<!--
function InputActions(field,id) {
var i=1;
var lid="none";
for (i=1;i<=100;i++) { lid='row'+i;
lidsec='rowsec'+i;
if (document.getElementById(lid) != null) {
if (lid==id) {
document.getElementById(lid).className='focus';
if (document.getElementById(lidsec) != null)
document.getElementById(lidsec).className='focus';
}
else {
document.getElementById(lid).className='';
if (document.getElementById(lidsec) != null)
document.getElementById(lidsec).className=''; }
} } } //-->
      </script>
      <form class="form"
action="http://www.123contactform.com/contact-form-crmamx-122034.html"
method="post" enctype="multipart/form-data"><input
name="action" value="verify" type="hidden" />
        <table style="min-width: 250px;" cellpadding="4">
          <tbody>
            <tr id="row1">
              <td style="text-align: left;" valign="top"><label
class="class123-label" id="id123-title684273"
for="id123-control684273">Name:</label><span
class="requiredspan customspan" title="Required field">*</span></td>
              <td style="" align="left"><input
id="id123-control684273" name="control684273"
onclick="InputActions(this,'row1');"
onkeyup="InputActions(this,'row1');" onchange="" value=""
size="20" type="text" />
              </td>
            </tr>
            <tr id="row2">
              <td style="text-align: left;" valign="top"><label
class="class123-label" id="id123-title684275"
for="id123-control684275">Subject:</label><span
class="requiredspan customspan" title="Required field">*</span></td>
              <td style="" align="left"><input
id="id123-control684275" name="control684275"
onclick="InputActions(this,'row2');"
onkeyup="InputActions(this,'row2');" onchange="" value=""
size="20" type="text" />
              </td>
            </tr>
            <tr id="row3">
              <td style="text-align: left;" valign="top"><label
class="class123-label" id="id123-title684281"
for="id123-control684281">Model Name:</label><span
class="requiredspan customspan" title="Required field">*</span></td>
              <td style="" align="left"><input
id="id123-control684281" name="control684281"
onclick="InputActions(this,'row3');"
onkeyup="InputActions(this,'row3');" onchange="" value=""
size="35" type="text" />
              </td>
            </tr>
            <tr id="row4">
              <td style="text-align: left;" valign="top"><label
class="class123-label" id="id123-title684286"
for="id123-control684286">Model Mfg:</label><span
class="requiredspan customspan" title="Required field">*</span></td>
              <td style="" align="left"><input
id="id123-control684286" name="control684286"
onclick="InputActions(this,'row4');"
onkeyup="InputActions(this,'row4');" onchange="" value=""
size="35" type="text" />
              </td>
            </tr>
            <tr id="row5">
              <td style="text-align: left;" valign="top"><label
class="class123-label" id="id123-title684287"
for="id123-control684287">Wingspan:</label><span
class="requiredspan customspan" title="Required field">*</span></td>
              <td style="" align="left"><input
id="id123-control684287" name="control684287"
onclick="InputActions(this,'row5');"
onkeyup="InputActions(this,'row5');" onchange="" value=""
size="35" type="text" />
              </td>
            </tr>
            <tr id="row6">
              <td style="text-align: left;" valign="top"><label
class="class123-label" id="id123-title684288"
for="id123-control684288">Engine Mfg/Size:</label><span
class="requiredspan customspan" title="Required field">*</span></td>
              <td style="" align="left"><input
id="id123-control684288" name="control684288"
onclick="InputActions(this,'row6');"
onkeyup="InputActions(this,'row6');" onchange="" value=""
size="35" type="text" />
              </td>
            </tr>
            <tr id="row7">
              <td style="text-align: left;" valign="top"><label
class="class123-label" id="id123-title684289"
for="id123-control684289">Decibel Reading:</label><span
class="requiredspan customspan" title="Required field">*</span></td>
              <td style="" align="left"><input
id="id123-control684289" name="control684289"
onclick="InputActions(this,'row7');"
onkeyup="InputActions(this,'row7');" onchange="" value=""
size="35" type="text" />
              </td>
            </tr>
            <tr id="row8">
              <td style="text-align: left;" valign="top"><label
class="class123-label" for="id123-captcha" id="verifno">Verification
No.:</label><span class="requiredspan customspan"
title="Required field">*</span></td>
              <td align="left" valign="top"><input
id="id123-captcha" onclick="InputActions(this,'row8');"
onkeyup="InputActions(this,'row8');" name="txtNumber"
value="" size="16" type="text" /></td>
            </tr>
            <tr>
              <td align="right"><a
title="Don't know why you have to enter this verification number? Click here!"
href="http://www.123contactform.com/faq.html#q1"
onclick="window.open('http://www.123contactform.com/faq.html#q1','_blank','width=740, height=90, left=' + (screen.width/2-370) + ', top=250');return false;"><img
src="http://www.123contactform.com/img/help_icon.gif"
alt="contact form faq" border="0" /></a></td>
              <td align="left"><img
alt="verification image"
src="http://www.123contactform.com/random.php" /></td>
            </tr>
            <tr>
              <td></td>
              <td align="left"><input
class="class123-button" id="id123-button-send"
value="Send email" type="submit" /></td>
            </tr>
          </tbody>
        </table>
        <div style="height: 1px; display: none; visibility: hidden;">
        <input name="email" type="text" /></div>
      </form>
      </center>
      </div>
      </td>
      <td height="171" width="4"></td>
    </tr>
  </tbody>
</table>
</center>
</body>
</html>

 

Of course I did not write this.

 

I have never used a form before built as a table, only like the form1.php

 

1. Does this form work in the same way?

2. I want to retrieve a record from the db and display it in this form. Do I do it in the same way as in form1.html with a value=?

3. If the above is true then I would assume (that always gets me in  trouble) that in my next program (update_db.php) I would capture the input data the same.

 

Thanks

 

Link to comment
https://forums.phpfreaks.com/topic/227656-something-other-than-the-standard-form/
Share on other sites

Pikachu:

 

I just noted that on the "simplest of forms" that works, I did not fetch id in the query. But id is available in the next program which is delete_db.php and works. hmmmmm

 

In fact, once I get the id to display I have to disable it so the user cannot change it since it is the key.

 

Also I am fixing "simplest of forms" with:

 

<?php echo $fetch['ama']; ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.