Page 1 of 1

Advice

Posted: Fri Nov 21, 2008 5:45 am
by tod900
Can anyone tell me which is better?

1. To write php and save file as external file for use with form.
2. To use Dreamweaver for form creation and php.

i find that a lot of php advice is very hard to understand because the php in dreamweaver is so complicated looking.

i'm now 6 months learning php and think it would be easier to fly to mars.

I just can't understand why php in dreamweaver is so different from the examples i get from books, video tutorials and the internet.

here is php from dreamweaver for a form which send business info to Database. one problem is how do i get the business_type field to send more than one value to the business_type field in the mysql database.

Code: Select all

<?php require_once('Connections/DI_Directory.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
 
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
        
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "DI_Update")) {
  $insertSQL = sprintf("INSERT INTO master_info (date_added, f_name, l_name, Gender, Logo_link, Instructor_pic, Instructor_Qualifacations, ADI_Number, Category_Type, business_name, address, Address2, TownAndCity, County, Business_type, Covered, zipcode, tel_number, Tel_Type, Business_No1, Business_No2, Mobile_number, Mobile_Type, fax_number, Fax_Type, website, email, email1_Type, email2, email2_Type, personal_notes, Company_info) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['Date_entered_hid'], "date"),
                       GetSQLValueString($_POST['FirstName'], "text"),
                       GetSQLValueString($_POST['SirName'], "text"),
                       GetSQLValueString($_POST['Gender'], "text"),
                       GetSQLValueString($_POST['Logo'], "text"),
                       GetSQLValueString($_POST['Instructor_pic'], "text"),
                       GetSQLValueString($_POST['InstructorQual'], "text"),
                       GetSQLValueString($_POST['ADI_Number'], "int"),
                       GetSQLValueString($_POST['Category_Type'], "text"),
                       GetSQLValueString($_POST['Business_Name'], "text"),
                       GetSQLValueString($_POST['Address1'], "text"),
                       GetSQLValueString($_POST['Address2'], "text"),
                       GetSQLValueString($_POST['Town'], "text"),
                       GetSQLValueString($_POST['CountyBox'], "text"),
                       GetSQLValueString($_POST['BusinessType'], "text"),
                       GetSQLValueString($_POST['AeraCovered'], "text"),
                       GetSQLValueString($_POST['ZipCode'], "text"),
                       GetSQLValueString($_POST['LandLine'], "text"),
                       GetSQLValueString($_POST['LandLine_Type'], "text"),
                       GetSQLValueString($_POST['Business_No1'], "text"),
                       GetSQLValueString($_POST['Business_No2'], "text"),
                       GetSQLValueString($_POST['MobileNumber'], "text"),
                       GetSQLValueString($_POST['Mobile_Type'], "text"),
                       GetSQLValueString($_POST['FaxNumber'], "text"),
                       GetSQLValueString($_POST['Fax_Type'], "text"),
                       GetSQLValueString($_POST['Website'], "text"),
                       GetSQLValueString($_POST['email1'], "text"),
                       GetSQLValueString($_POST['Email_Type'], "text"),
                       GetSQLValueString($_POST['email2'], "text"),
                       GetSQLValueString($_POST['Email2_Type'], "text"),
                       GetSQLValueString($_POST['Mobile_Type'], "text"),
                       GetSQLValueString($_POST['Persional_Notes'], "text"));
 
  mysql_select_db($database_DI_Directory, $DI_Directory);
  $Result1 = mysql_query($insertSQL, $DI_Directory) or die(mysql_error());
}
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Master_info = "SELECT date_added, f_name, l_name, Logo_link, Instructor_pic, Instructor_Qualifacations, ADI_Number, business_name, address, Address2, TownAndCity, County, Business_type, Listing_type, Covered, zipcode, tel_number, Tel_Type, Business_No1, Business_No2, Mobile_number, Mobile_Type, fax_number, Fax_Type, website, email, email1_Type, email2, email2_Type, personal_notes, Company_info FROM master_info";
$Master_info = mysql_query($query_Master_info, $DI_Directory) or die(mysql_error());
$row_Master_info = mysql_fetch_assoc($Master_info);
$totalRows_Master_info = mysql_num_rows($Master_info);
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Business_type = "SELECT Business_type FROM business_type";
$Business_type = mysql_query($query_Business_type, $DI_Directory) or die(mysql_error());
$row_Business_type = mysql_fetch_assoc($Business_type);
$totalRows_Business_type = mysql_num_rows($Business_type);
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_County = "SELECT County FROM county";
$County = mysql_query($query_County, $DI_Directory) or die(mysql_error());
$row_County = mysql_fetch_assoc($County);
$totalRows_County = mysql_num_rows($County);
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Covered = "SELECT Covered FROM covered";
$Covered = mysql_query($query_Covered, $DI_Directory) or die(mysql_error());
$row_Covered = mysql_fetch_assoc($Covered);
$totalRows_Covered = mysql_num_rows($Covered);
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Instructor_Qual = "SELECT Instructor_Qualifacations FROM instructor_qual";
$Instructor_Qual = mysql_query($query_Instructor_Qual, $DI_Directory) or die(mysql_error());
$row_Instructor_Qual = mysql_fetch_assoc($Instructor_Qual);
$totalRows_Instructor_Qual = mysql_num_rows($Instructor_Qual);
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Listing_Type = "SELECT Listing_type FROM listing_type";
$Listing_Type = mysql_query($query_Listing_Type, $DI_Directory) or die(mysql_error());
$row_Listing_Type = mysql_fetch_assoc($Listing_Type);
$totalRows_Listing_Type = mysql_num_rows($Listing_Type);
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Contact_Type = "SELECT Contact_Type FROM contact_type";
$Contact_Type = mysql_query($query_Contact_Type, $DI_Directory) or die(mysql_error());
$row_Contact_Type = mysql_fetch_assoc($Contact_Type);
$totalRows_Contact_Type = mysql_num_rows($Contact_Type);
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Category_Type = "SELECT Category_Type FROM category_type";
$Category_Type = mysql_query($query_Category_Type, $DI_Directory) or die(mysql_error());
$row_Category_Type = mysql_fetch_assoc($Category_Type);
$totalRows_Category_Type = mysql_num_rows($Category_Type);
 
mysql_select_db($database_DI_Directory, $DI_Directory);
$query_Gender = "SELECT Gender FROM gender";
$Gender = mysql_query($query_Gender, $DI_Directory) or die(mysql_error());
$row_Gender = mysql_fetch_assoc($Gender);
$totalRows_Gender = mysql_num_rows($Gender);
?>
 
<!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"><!-- InstanceBegin template="/Templates/DBtemp.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Business Directory</title>
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
    background-color: #CCD8E6;
}
-->
</style>
<link href="CSSfiles/CSSfiles.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
.ToShowOnSite {color: #FF0000}
-->
</style>
<!-- InstanceEndEditable -->
</head>
 
<body>
<table width="843" height="178" align="center">
  <tr>
    <td height="35" colspan="3" align="left" valign="top" class="Header"><!-- InstanceBeginEditable name="Head" -->
      <div align="center">Page For updating Databases </div>
    <!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td width="20%" height="135" align="left" valign="top"><table width="29%" height="129">
      <tr>
        <td height="116" align="left" valign="top" nowrap="nowrap"><p><a href="Home.php">Home</a></p>
          <p><a href="search.php">Search DB</a> <br />
              <a href="Images.php">Add Images</a><br />
              <a href="Feedback.php">Add Feedback</a><br />
          <a href="BusinessDirectory.php">Add Business </a></p>
          <p align="left">Add to<br />
              Database:<br />
            </p>          <p>Display Listings <br />
            Add County<br />
    Add Town <br />
               Add 
              <br />
</p>          </td>
      </tr>
    </table>    </td>
    <td width="64%" align="left" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->
      <p>&nbsp;</p>
      <form action="<?php echo $editFormAction; ?>" id="DI_Update" name="DI_Update" method="POST">
        <table width="494" height="1592" border="0" align="center" cellpadding="0" cellspacing="0">
          
          <tr>
            <td nowrap="nowrap">DATE Entered </td>
            <td>&nbsp;</td>
            <td colspan="2"><input name="Date_entered_hid" type="hidden" value="<?php $mysqltime = date ("Y-m-d H:i:s"); 
    echo $mysqltime;
    ?>" id="Date_entered_hid" />
            <?php $mysqltime = date ("Y-m-d H:i:s"); 
    echo $mysqltime;
    ?></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td colspan="2">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap"><strong>Name and Postal Address: </strong></td>
          </tr>
          <tr>
            <td width="102" nowrap="nowrap">&nbsp;</td>
            <td width="4">&nbsp;</td>
            <td colspan="2">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td width="14">&nbsp;</td>
            <td width="62">&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap"><span class="ToShowOnSite">*</span>First Name</td>
            <td>&nbsp;</td>
            <td colspan="2"><input name="FirstName" type="text" id="FirstName" size="30" maxlength="30" /></td>
            <td colspan="3">Gender            
              <select name="Gender" id="Gender">
                <?php
do {  
?>
                <option value="<?php echo $row_Gender['Gender']?>"><?php echo $row_Gender['Gender']?></option>
                <?php
} while ($row_Gender = mysql_fetch_assoc($Gender));
  $rows = mysql_num_rows($Gender);
  if($rows > 0) {
      mysql_data_seek($Gender, 0);
      $row_Gender = mysql_fetch_assoc($Gender);
  }
?>
              </select>            </td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td width="156">&nbsp;</td>
            <td width="96">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap"><span class="ToShowOnSite">*</span>Sir Name</td>
            <td>&nbsp;</td>
            <td colspan="2"><input name="SirName" type="text" id="SirName" size="30" maxlength="30" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">Address 1</td>
            <td>&nbsp;</td>
            <td colspan="3"><input name="Address1" type="text" id="Address1" size="50" maxlength="50" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">Address 2</td>
            <td>&nbsp;</td>
            <td colspan="3"><input name="Address2" type="text" id="Address2" size="50" maxlength="50" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          
          <tr>
            <td nowrap="nowrap">Town</td>
            <td>&nbsp;</td>
            <td colspan="3"><input name="Town" type="text" id="Town" size="50" maxlength="50" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">County</td>
            <td>&nbsp;</td>
            <td colspan="2"><select name="CountyBox" id="CountyBox">
              <option value="Please Select">Please Select</option>
              <?php
do {  
?>
              <option value="<?php echo $row_County['County']?>"><?php echo $row_County['County']?></option>
              <?php
} while ($row_County = mysql_fetch_assoc($County));
  $rows = mysql_num_rows($County);
  if($rows > 0) {
      mysql_data_seek($County, 0);
      $row_County = mysql_fetch_assoc($County);
  }
?>
                
            </select></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">ZipCode</td>
            <td>&nbsp;</td>
            <td><input name="ZipCode" type="text" id="ZipCode" size="10" maxlength="10" />
              not needed </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap">........................................................................................................................</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap"><strong>Contact Details: </strong></td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">Mobile Number</td>
            <td>&nbsp;</td>
            <td><input name="MobileNumber" type="text" id="MobileNumber" size="13" maxlength="13" /></td>
            <td><select name="Mobile_Type" id="Mobile_Type">
              <?php
do {  
?>
              <option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
  $rows = mysql_num_rows($Contact_Type);
  if($rows > 0) {
      mysql_data_seek($Contact_Type, 0);
      $row_Contact_Type = mysql_fetch_assoc($Contact_Type);
  }
?>
              
            </select>            </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">Land Line </td>
            <td>&nbsp;</td>
            <td><input name="LandLine" type="text" id="LandLine" size="15" maxlength="15" /></td>
            <td><select name="LandLine_Type" id="LandLine_Type">
              <?php
do {  
?>
              <option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
  $rows = mysql_num_rows($Contact_Type);
  if($rows > 0) {
      mysql_data_seek($Contact_Type, 0);
      $row_Contact_Type = mysql_fetch_assoc($Contact_Type);
  }
?>
              
            </select></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">Fax</td>
            <td>&nbsp;</td>
            <td><input name="FaxNumber" type="text" id="FaxNumber" size="15" maxlength="15" /></td>
            <td><select name="Fax_Type" id="Fax_Type">
              <?php
do {  
?>
              <option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
  $rows = mysql_num_rows($Contact_Type);
  if($rows > 0) {
      mysql_data_seek($Contact_Type, 0);
      $row_Contact_Type = mysql_fetch_assoc($Contact_Type);
  }
?>
              
            </select></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          
          <tr>
            <td nowrap="nowrap"><span class="ToShowOnSite">*</span>E-Mail</td>
            <td>&nbsp;</td>
            <td colspan="3"><input name="email1" type="text" id="email1" size="50" maxlength="50" /></td>
            <td>&nbsp;</td>
            <td><select name="Email_Type" id="Email_Type">
              <?php
do {  
?>
              <option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
<?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
  $rows = mysql_num_rows($Contact_Type);
  if($rows > 0) {
      mysql_data_seek($Contact_Type, 0);
      $row_Contact_Type = mysql_fetch_assoc($Contact_Type);
  }
?>
              
            </select></td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">E-Mail 2</td>
            <td>&nbsp;</td>
            <td colspan="3"><input name="email2" type="text" id="email2" size="50" maxlength="50" /></td>
            <td>&nbsp;</td>
            <td><select name="Email2_Type" id="Email2_Type">
              <?php
do {  
?>
              <option value="<?php echo $row_Contact_Type['Contact_Type']?>"><?php echo $row_Contact_Type['Contact_Type']?></option>
              <?php
} while ($row_Contact_Type = mysql_fetch_assoc($Contact_Type));
  $rows = mysql_num_rows($Contact_Type);
  if($rows > 0) {
      mysql_data_seek($Contact_Type, 0);
      $row_Contact_Type = mysql_fetch_assoc($Contact_Type);
  }
?>
              
            </select></td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap">........................................................................................................................</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap"><strong>Instructor Details: </strong></td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="24" nowrap="nowrap"><span class="ToShowOnSite">*</span>Instructo Pic </td>
            <td>&nbsp;</td>
            <td colspan="2"><input name="Instructor_pic" type="file" id="Instructor_pic" /></td>
            <td valign="top"><br /></td>
            <td colspan="2" rowspan="3" valign="top"><span class="ToShowOnSite">*</span>Categories
              <select name="Category_Type" size="6" id="Category_Type">
                <?php
do {  
?>
                <option value="<?php echo $row_Category_Type['Category_Type']?>"><?php echo $row_Category_Type['Category_Type']?></option>
                <?php
} while ($row_Category_Type = mysql_fetch_assoc($Category_Type));
  $rows = mysql_num_rows($Category_Type);
  if($rows > 0) {
      mysql_data_seek($Category_Type, 0);
      $row_Category_Type = mysql_fetch_assoc($Category_Type);
  }
?>
              </select></td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td valign="top">&nbsp;</td>
          </tr>
          
          <tr>
            <td><p><span class="ToShowOnSite">*</span>Instructor Quaifications<br />
              / Membership
            </p>            </td>
            <td>&nbsp;</td>
            <td><select name="InstructorQual[]" size="4" multiple="multiple" id="InstructorQual">
              <?php
do {  
?>
              <option value="<?php echo $row_Instructor_Qual['Instructor_Qualifacations']?>"><?php echo $row_Instructor_Qual['Instructor_Qualifacations']?></option>
              <?php
} while ($row_Instructor_Qual = mysql_fetch_assoc($Instructor_Qual));
  $rows = mysql_num_rows($Instructor_Qual);
  if($rows > 0) {  // if ($val!=''){ 
      mysql_data_seek($Instructor_Qual, 0);
      $row_Instructor_Qual = mysql_fetch_assoc($Instructor_Qual);
  }
?>
              
            </select></td>
            <td valign="top"><p><span class="ToShowOnSite">*</span>ADI Number <br />
                <input name="ADI_Number" type="text" id="ADI_Number" size="7" maxlength="7" />
                <br />
            </p>            </td>
            <td valign="top">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap">&nbsp;</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap">........................................................................................................................</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap"><strong>Business Information:</strong></td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right" nowrap="nowrap"><p><span class="ToShowOnSite">*</span>Business Name<br />
            Place of work </p>            </td>
            <td>&nbsp;</td>
            <td colspan="3" align="right" valign="middle"><input name="Business_Name" type="text" id="Business_Name" size="50" maxlength="50" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap"><div align="right"><span class="ToShowOnSite">*</span>Business Phone</div></td>
            <td>&nbsp;</td>
            <td nowrap="nowrap">1
            <input name="Business_No1" type="text" id="Business_No1" /></td>
            <td colspan="2" nowrap="nowrap">2
            <input name="Business_No2" type="text" id="Business_No2" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">*Website</td>
            <td>&nbsp;</td>
            <td colspan="3"><input name="Website" type="text" id="Website" size="50" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right" nowrap="nowrap"><span class="ToShowOnSite">*</span>Business Type</td>
            <td>&nbsp;</td>
                        <td><select name="BusinessType" size="4" multiple="MULTIPLE" id="BusinessType">
              <?php
do {  
?>
              <option value="<?php echo $row_Business_type['Business_type']?>"><?php echo $row_Business_type['Business_type']?></option>
                <?php
} while ($row_Business_type = mysql_fetch_assoc($Business_type));
  $rows = mysql_num_rows($Business_type);
  if($rows > 0) {
      mysql_data_seek($Business_type, 0);
      $row_Business_type = mysql_fetch_assoc($Business_type);
  }
?>
              
            </select></td>
            <td colspan="2" align="left" valign="top">Hold the ctrl key to select more than one business type. </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right" nowrap="nowrap"><span class="ToShowOnSite">*</span>Logo</td>
            <td>&nbsp;</td>
            <td colspan="2"><input name="Logo" type="file" id="Logo" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          
          <tr>
            <td align="center" valign="top" nowrap="nowrap"><span class="ToShowOnSite">*</span>Company Info</td>
            <td>&nbsp;</td>
            <td colspan="3"><textarea name="Comapny_info" cols="40" rows="10" wrap="virtual" id="Comapny_info"></textarea></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td align="right" nowrap="nowrap"><span class="ToShowOnSite">*</span>Area Coverd </td>
            <td>&nbsp;</td>
            <td colspan="2"><select name="AeraCovered" size="5" multiple="multiple" id="AeraCovered">
              <?php
do {  
?>
              <option value="<?php echo $row_Covered['Covered']?>"><?php echo $row_Covered['Covered']?></option>
              <?php
} while ($row_Covered = mysql_fetch_assoc($Covered));
  $rows = mysql_num_rows($Covered);
  if($rows > 0) {
      mysql_data_seek($Covered, 0);
      $row_Covered = mysql_fetch_assoc($Covered);
  }
?>
              
            </select></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          
          <tr>
            <td colspan="7" nowrap="nowrap">........................................................................................................................</td>
          </tr>
          <tr>
            <td colspan="7" nowrap="nowrap"><span class="ToShowOnSite"><strong>Category of Business Listing </strong></span></td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap"><span class="ToShowOnSite">Listing Type</span> </td>
            <td>&nbsp;</td>
            <td><select name="Listing Type" id="Listing Type">
              <option value="Please Select">Please Select</option>
              <?php
do {  
?>
              <option value="<?php echo $row_Listing_Type['Listing_type']?>"><?php echo $row_Listing_Type['Listing_type']?></option>
              <?php
} while ($row_Listing_Type = mysql_fetch_assoc($Listing_Type));
  $rows = mysql_num_rows($Listing_Type);
  if($rows > 0) {
      mysql_data_seek($Listing_Type, 0);
      $row_Listing_Type = mysql_fetch_assoc($Listing_Type);
  }
?>
             
            </select></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td valign="top">Notes about this coustomer </td>
            <td>&nbsp;</td>
            <td colspan="2"><textarea name="Persional_Notes" wrap="physical" id="Persional_Notes"></textarea></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td><input type="submit" name="Submit" value="Submit" /></td>
            <td><a href="phpScripts/Submit.php">Submit Link </a></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td height="19" nowrap="nowrap">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
        <input type="hidden" name="MM_insert" value="DI_Update">
      </form>
      <p>&nbsp;</p>
      <p>&nbsp; </p>
    <!-- InstanceEndEditable --></td>
    <td width="16%" align="left" valign="top"><table width="17%" height="66" align="right">
        <tr>
          <td height="40" align="left" nowrap="nowrap">My Websites:<br />
            
        </tr>
    </table>    </td></tr>
</table>
</body><!-- InstanceEnd -->
</html>
<?php
mysql_free_result($Master_info);
 
mysql_free_result($Business_type);
 
mysql_free_result($County);
 
mysql_free_result($Covered);
 
mysql_free_result($Instructor_Qual);
 
mysql_free_result($Listing_Type);
 
mysql_free_result($Contact_Type);
 
mysql_free_result($Category_Type);
 
mysql_free_result($Gender);
?>

Re: Advice

Posted: Fri Nov 21, 2008 5:58 am
by papa
3. Put my code in code tags?

Re: Advice

Posted: Fri Nov 21, 2008 6:02 am
by tod900
papa wrote:3. Put my code in code tags?

Sorry Done

Can you help

Re: Advice

Posted: Fri Nov 21, 2008 7:08 am
by papa
If I may suggest,

If you want to learn PHP, start from scratch and make more advanced code as you go along. It's hard to understand code if you have skipped most of the basics, also you will not learn how to make good and effective code yourself. I haven't looked at dreamweaver for many years but generated code is usually a big mess as we can see in your initial post.
Learning how to work with databases etc is not a very big step and you'll probably be able to make some nice functions within a week or so if you are determined.

If you are not interested in learning PHP or just want to know the basics, I would download finished scripts and then edit them.

Re: Advice

Posted: Fri Nov 21, 2008 7:38 am
by tod900
papa wrote:If I may suggest,

If you want to learn PHP, start from scratch and make more advanced code as you go along. It's hard to understand code if you have skipped most of the basics, also you will not learn how to make good and effective code yourself. I haven't looked at dreamweaver for many years but generated code is usually a big mess as we can see in your initial post.
Learning how to work with databases etc is not a very big step and you'll probably be able to make some nice functions within a week or so if you are determined.

If you are not interested in learning PHP or just want to know the basics, I would download finished scripts and then edit them.
Do you know of any good video tutorials or php books as finding good source information is not easy.

Re: Advice

Posted: Fri Nov 21, 2008 8:03 am
by papa
I prefer Wrox:
http://www.wrox.com/WileyCDA/WroxTitle/ ... 57440.html
http://www.wrox.com/WileyCDA/WroxTitle/ ... 57831.html

I have PHP 4 beginning, advanced and just bought a book about ajax, h have never used any video tutorials I'm afraid.

Usually I read the book and do the examples at the same time. Go at your own pace and it's easy to go back, make notes etc. If I want to do something specific I search on Google for a tutorial.

Re: Advice

Posted: Fri Nov 21, 2008 1:37 pm
by califdon
papa wrote:If I may suggest,

If you want to learn PHP, start from scratch and make more advanced code as you go along. It's hard to understand code if you have skipped most of the basics, also you will not learn how to make good and effective code yourself. I haven't looked at dreamweaver for many years but generated code is usually a big mess as we can see in your initial post.
Learning how to work with databases etc is not a very big step and you'll probably be able to make some nice functions within a week or so if you are determined.

If you are not interested in learning PHP or just want to know the basics, I would download finished scripts and then edit them.
I agree wholeheartedly with papa. There is a natural tendency to take the "easy" road, thinking that it's a waste of time to learn the basics, and sometimes that works with very simple tasks, but if you want to do anything seriously, there is no substitute for learning the fundamentals.