Jump to content

[SOLVED] DropDown Menu & Dynamic Fields, Display Database Record


karl_009

Recommended Posts

Hello,

 

I have a HTML form that displays data from a MySQL database using PHP & JavaScript.

 

The JavaScript is dynamically getting data into fields from the database via a dropdown menu, the value in the menu that is selected when the form is submitted is also submitted to the database, only the dropdown menu value is being submitted not the dynamic fields.

 

I have set up a form where the data is to be viewed; however the dropdown menu needs to have someone select the data again to display the relevant information.

 

I believe it’s to do with the dropdown menu part but I am unable to find a solution.

 

 

Many Thanks

Karl

 

<?php
        require ("include/db_config.php");
        $connection = @mysql_connect ($db_host, $db_user, $db_pass) or die ("Error with Connection");
        mysql_select_db ($db_name, $connection);
        
        // Get value from address bar
        $contid=$_GET['contid'];
        
        // Get data from database
        $query = "SELECT * FROM man_contracts WHERE contid='$contid'";
        $result = mysql_query ($query);
        
        $rows = mysql_fetch_array ($result);
?>

<?php 
   $vbCrLf = chr(13).chr(10);
   // open connection to MySQL server
   $connection = mysql_connect('localhost', 'root', 'pass')
   or die ('Unable to connect!');
               
   //select database
   mysql_select_db('cmpkaspi') or die ('Unable to select database!');
               
   //create and execute query
   $query = 'SELECT suppname, suppadd1, suppadd2, suppcity, suppregion, supppostc, suppcountry FROM man_suppliers ORDER BY suppname';
   $result = mysql_query($query) or die ('Error in query: $query. ' . mysql_error());
               
   //create selection list
   $DropDownList .= "<select name='suppname' id='suppname' class='field select medium' onchange='javascript:SelectChanged();'> ".$vbCrLf;
   $DropDownList .= "<option value=''></option> ".$vbCrLf;
   
   while($row = mysql_fetch_row($result))
   {
      $heading = $row[0];
      $DropDownList .= "<option value='$heading'>$heading</option> ".$vbCrLf;
      $Add1ArrayPhp .= 'Add1Array["'.$heading.'"]="'.$row[1].'";'.$vbCrLf;
      $Add2ArrayPhp .= 'Add2Array["'.$heading.'"]="'.$row[2].'";'.$vbCrLf;
      $CityArrayPhp .= 'CityArray["'.$heading.'"]="'.$row[3].'";'.$vbCrLf;
          $RegionArrayPhp .= 'RegionArray["'.$heading.'"]="'.$row[4].'";'.$vbCrLf;
          $PostCodeArrayPhp .= 'PostCodeArray["'.$heading.'"]="'.$row[5].'";'.$vbCrLf;
          $CountryArrayPhp .= 'CountryArray["'.$heading.'"]="'.$row[6].'";'.$vbCrLf;
   }
   $DropDownList .= "</select> ".$vbCrLf;
?>
<html>
<head>
<script language="Javascript" type="text/javascript">
   var Add1Array = new Array();
   <?php echo $Add1ArrayPhp; ?>
   var Add2Array = new Array();
   <?php echo $Add2ArrayPhp; ?>
   var CityArray = new Array();
   <?php echo $CityArrayPhp; ?>
   var RegionArray = new Array();
   <?php echo $RegionArrayPhp; ?>
   var PostCodeArray = new Array();
   <?php echo $PostCodeArrayPhp; ?>
   var CountryArray = new Array();
   <?php echo $CountryArrayPhp; ?>
   function SelectChanged()
   {
      var Company = document.getElementById('suppname').value;
      document.getElementById('suppadd1').value = Add1Array[Company];
      document.getElementById('suppadd2').value = Add2Array[Company];
      document.getElementById('suppcity').value = CityArray[Company];
      document.getElementById('suppregion').value = RegionArray[Company];
      document.getElementById('supppostc').value = PostCodeArray[Company];
      document.getElementById('suppcountry').value = CountryArray[Company];
   }
</script>
</head>
<body id="public">
        
<img id="top" src="images/top.png" alt="" />
<div id="container">

<form id="contracts" name="contracts" class="" autocomplete="off"
        enctype="multipart/form-data" method="post" action="contract_view.php">

<div class="info">
        <h2>Contract Details</h2>
        <div></div>
</div>

<ul>
                
        
<li id="foli1"          class="   ">
        <label class="desc" id="title1" for="Field1">
                Contract Name
                                <span id="req_1" class="req">*</span>
                        </label>
        <div>
                <input id="contname"  name="contname"   type="text"     class="field text large"        value="<?php echo $rows['contname']; ?>"        maxlength="255"                         tabindex="1"                                            />
                        </div>
        </li>


<li id="foli3"          class="   ">
        <label class="desc" id="title3" for="Field3">
                Supplier Name
                                <span id="req_3" class="req">*</span>
                        </label>
        <div>
                <?php echo $DropDownList; ?>
        </div>
        </li>

Link to comment
Share on other sites

Hi

 

I cannot see anything creating dynamic fields, or anything populating fields. Add into the form the following fields:-

 

      <input type='hidden' name='suppadd1' id='suppadd1' value'' />
      <input type='hidden' name='suppadd2' id='suppadd2' value'' />
      <input type='hidden' name='suppcity' id='suppcity' value'' />
      <input type='hidden' name='suppregion' id='suppregion' value'' />
      <input type='hidden' name='supppostc' id='supppostc' value'' />
      <input type='hidden' name='suppcountry' id='suppcountry' value'' />

 

All the best

 

Keith

Link to comment
Share on other sites

Hello,

 

I might have used the wrong wording then.

 

The $DropDownList that is created by the PHP gets data from a table, and when you select that data it retrieves the data and displays it in a number of fields on the form.

 

The dropdown menu called $DropDownList enters the selected value into the database "suppname".

 

The fields of data that this retrieves are not entered into the new table.

 

But this form is to view data that has already been selected and entered, so when a user opens this form to view a record, the saved value in the database for suppname which is selected by dropdown menu called $DropDownList is not retrieves and the information is not shown.

 

Here is the full code;

 

<?php
require ("include/db_config.php");
$connection = @mysql_connect ($db_host, $db_user, $db_pass) or die ("Error with Connection");
mysql_select_db ($db_name, $connection);

// Get value from address bar
$contid=$_GET['contid'];

// Get data from database
$query = "SELECT * FROM man_contracts WHERE contid='$contid'";
$result = mysql_query ($query);

$rows = mysql_fetch_array ($result);
?>

<?php 
   $vbCrLf = chr(13).chr(10);
   // open connection to MySQL server
   $connection = mysql_connect('localhost', 'root', 'pass')
   or die ('Unable to connect!');
               
   //select database
   mysql_select_db('cmp') or die ('Unable to select database!');
               
   //create and execute query
   $query = 'SELECT suppname, suppadd1, suppadd2, suppcity, suppregion, supppostc, suppcountry FROM man_suppliers ORDER BY suppname';
   $result = mysql_query($query) or die ('Error in query: $query. ' . mysql_error());
               
   //create selection list
   $DropDownList .= "<select name='suppname' id='suppname' class='field select medium' onchange='javascript:SelectChanged();'> ".$vbCrLf;
   $DropDownList .= "<option value=''></option> ".$vbCrLf;
   
   while($row = mysql_fetch_row($result))
   {
      $heading = $row[0];
      $DropDownList .= "<option value='$heading'>$heading</option> ".$vbCrLf;
      $Add1ArrayPhp .= 'Add1Array["'.$heading.'"]="'.$row[1].'";'.$vbCrLf;
      $Add2ArrayPhp .= 'Add2Array["'.$heading.'"]="'.$row[2].'";'.$vbCrLf;
      $CityArrayPhp .= 'CityArray["'.$heading.'"]="'.$row[3].'";'.$vbCrLf;
  $RegionArrayPhp .= 'RegionArray["'.$heading.'"]="'.$row[4].'";'.$vbCrLf;
  $PostCodeArrayPhp .= 'PostCodeArray["'.$heading.'"]="'.$row[5].'";'.$vbCrLf;
  $CountryArrayPhp .= 'CountryArray["'.$heading.'"]="'.$row[6].'";'.$vbCrLf;
   }
   $DropDownList .= "</select> ".$vbCrLf;
?>


<html>
<head>

<title>
Contract Details
</title>

<script language="Javascript" type="text/javascript">
   var Add1Array = new Array();
   <?php echo $Add1ArrayPhp; ?>
   var Add2Array = new Array();
   <?php echo $Add2ArrayPhp; ?>
   var CityArray = new Array();
   <?php echo $CityArrayPhp; ?>
   var RegionArray = new Array();
   <?php echo $RegionArrayPhp; ?>
   var PostCodeArray = new Array();
   <?php echo $PostCodeArrayPhp; ?>
   var CountryArray = new Array();
   <?php echo $CountryArrayPhp; ?>
   function SelectChanged()
   {
      var Company = document.getElementById('suppname').value;
      document.getElementById('suppadd1').value = Add1Array[Company];
      document.getElementById('suppadd2').value = Add2Array[Company];
      document.getElementById('suppcity').value = CityArray[Company];
  document.getElementById('suppregion').value = RegionArray[Company];
  document.getElementById('supppostc').value = PostCodeArray[Company];
  document.getElementById('suppcountry').value = CountryArray[Company];
   }
</script>
</head>

<body id="public">

<img id="top" src="images/top.png" alt="" />
<div id="container">

<form id="contracts" name="contracts" class="" autocomplete="off"
enctype="multipart/form-data" method="post" action="contract_view.php">

<div class="info">
<h2>Contract Details</h2>
<div></div>
</div>

<ul>


<li id="foli1" 		class="   ">
<label class="desc" id="title1" for="Field1">
	Contract Name
			<span id="req_1" class="req">*</span>
		</label>
<div>
	<input id="contname"  name="contname" 	type="text" 	class="field text large" 	value="<?php echo $rows['contname']; ?>" 	maxlength="255" 			tabindex="1" 						/>
		</div>
</li>


<li id="foli3" 		class="   ">
<label class="desc" id="title3" for="Field3">
	Supplier Name
			<span id="req_3" class="req">*</span>
		</label>
<div>
	<?php echo $DropDownList; ?>
</div>
</li>


<li id="foli7" 		class="   ">
<label class="desc" id="title7" for="Field7">
	Type of Contract
			<span id="req_7" class="req">*</span>
	</label>
<div>
  <select id="conttype" 	name="conttype" 	class="field select medium" 	value=""	tabindex="3">
        <option value=""></option>
<option value="Hardware Maintenance" <? if($rows['conttype'] == "Hardware Maintenance") echo "selected"; ?>> Hardware Maintenance </option>
<option value="Software Maintenance" <? if($rows['conttype'] == "Software Maintenance") echo "selected"; ?>> Software Maintenance </option>
<option value="Printing Lease" <? if($rows['conttype'] == "Printing Lease") echo "selected"; ?>> Printing Lease </option>
<option value="Leasing" <? if($rows['conttype'] == "Printing Lease") echo "selected"; ?>> Leasing </option>
<option value="Location" <? if($rows['conttype'] == "Printing Lease") echo "selected"; ?>> Location </option>

        
      </select>
</div>
</li>


<li id="foli9" 		class="   ">
<label class="desc" id="title9" for="Field9">
	Status
			<span id="req_9" class="req">*</span>
	</label>
<div>
	<select id="contstatus" 	name="contstatus" 	class="field select medium"		value="<?php echo $rows['contstatus']; ?>" 	tabindex="4"> 
        	<option value=""><?php echo $rows['contstatus']; ?></option>
		<option value="Awaiting Approval">Awaiting Approval</option>
		<option value="Active">Active</option>
		<option value="Expired">Expired</option>
	</select>
</div>
</li>


<li id="foli11" 
	class="   ">


<label class="desc" id="title11" for="Field11">
	Contract Notes
		</label>

<div>
		<textarea id="contnotes" 
		name="contnotes" 
		class="field textarea medium"
		rows="10" cols="50"
		tabindex="5">
            <?php echo $rows['contnotes']; ?>
            </textarea>

		</div>
            
</li>
    
<li id="foli12" 		class="   ">
<label class="desc" id="title12" for="Field12">
	Start Date
		</label>
<span>
	<input id="contsd" 	name="contsd" 	type="text" 	class="field text" 	value="<?php echo $rows['contsd']; ?>" 	size="2" 	maxlength="2" 			tabindex="6" 			/> /
	<label for="param1">DD</label>
</span>
<span>
	<input id="contsm" 	name="contsm" 	type="text"  	class="field text" 	value="<?php echo $rows['contsm']; ?>" 	size="2" 	maxlength="2" 			tabindex="7" 			/> /
	<label for="param2">MM</label>
</span>
<span>
 	<input id="contsy" 	name="contsy" 	type="text" 	class="field text" 	value="<?php echo $rows['contsy']; ?>" 	size="4" 	maxlength="4" 			tabindex="8" 			/>
	<label for="param3">YYYY</label>
</span>
</li>

<li id="foli13" 		class="   ">
<label class="desc" id="title13" for="Field13">
	End Date
			<span id="req_13" class="req">*</span>
		</label>
<span>
	<input id="conted" 	name="conted" 	type="text" 	class="field text" 	value="<?php echo $rows['conted']; ?>" 	size="2" 	maxlength="2" 			tabindex="9" 			/> /
	<label for="Field13-1">DD</label>
</span>
<span>
	<input id="contem" 	name="contem" 	type="text" 	class="field text" 	value="<?php echo $rows['contem']; ?>" 	size="2" 	maxlength="2" 			tabindex="10" 			/> /
	<label for="Field13-2">MM</label>
</span>
<span>
 	<input id="contey" 	name="contey" 	type="text" 	class="field text" 	value="<?php echo $rows['contey']; ?>" 	size="4" 	maxlength="4" 			tabindex="11" 			/>
	<label for="Field13">YYYY</label>
</span>
</li>


<li id="foli14" 		class="   ">
<label class="desc" id="title14" for="Field14">
	Address
		</label>
<div class="column">
	<span class="full">
	<input id="suppadd1" 	name="suppadd1" 	type="text" 	class="field text addr" 	value="" 	tabindex="12"	disabled 	/>
	<label for="Field14">Street Address</label>
	</span>
	<span class="full">
	<input id="suppadd2" 	name="suppadd2" 	type="text" 	class="field text addr" 	value="" 	tabindex="13"	disabled 	/>
	<label for="Field15">Address Line 2</label>
	</span>
	<span class="left">
	<input id="suppcity" 	name="suppcity" 	type="text" 	class="field text addr" 	value="" 	tabindex="14"	disabled 	/>
	<label for="Field16">City</label>
	</span>
	<span class="right">
	<input id="suppregion" 	name="suppregion" 	type="text" 	class="field text addr" 	value="" 	tabindex="15"	disabled 	/>
	<label for="Field17">State / Province / Region</label>
	</span>
	<span class="left">
	<input id="supppostc" 	name="supppostc" 	type="text" 	class="field text addr" 	value="" 	tabindex="16"	disabled 	/>
	<label for="Field18">Postal / Zip Code</label>
	</span>
	<span class="right">
        <input id="suppcountry" 	name="suppcountry" 	type="text" 	class="field text addr" 	value="" 	tabindex="17"	disabled 	/>
	<label for="Field19">Country</label>
	</span>
</div>
</li>


<li id="foli20" 		class="   ">
<div class="column">
<label class="desc" id="title20" for="Field20">
	Cost / Cost Duration
</label>
            
<span class="symbol">£</span>
<span>
	<input id="contcospo" 	name="contcospo" 	type="text" 	class="field text" 	value="<?php echo $rows['contcospo']; ?>" 	size="4"	maxlength="4" 	tabindex="18" 	/> .	<label for="Field20">Pounds</label>
</span>
     
<span>
	<input id="contcospe" 	name="contcospe" 	type="text" 	class="field text" 	value="<?php echo $rows['contcospe']; ?>" 	size="2" 	maxlength="2" 	tabindex="19" 	/>
	<label for="Field20-1">Pence</label>
</span>
    
    <span class="right">
	<select id="contcosps" 	name="contcosps" 	class="field select large"	value="<?php echo $rows['contcosps']; ?>" 	tabindex="20"> 
        	<option value=""><?php echo $rows['contcosps']; ?> </option>
		<option value="Weekly" >Weekly</option>
		<option value="Monthly">Monthly</option>
		<option value="Yearly">Yearly</option>
        </select>
        <label for="Field17">Duration</label>
    </span>
    </div>
</li>

<li class="buttons">
			<input id="saveForm" class="" type="Submit" value="Main Contracts"  />
		    <input type="hidden" value="<?php echo $rows['contid']; ?>" name="contid" id="contid">
                <input type="hidden" value="TURE" name="submitted">
		</li>

<li style="display:none">
	<label for="comment">Do Not Fill This Out</label>
	<textarea name="comment" id="comment" rows="1" cols="1"></textarea>
</li>
</ul>
</form>

</div><!--container-->
<img id="bottom" src="images/bottom.png" alt="" />

</body>
</html>

Link to comment
Share on other sites

Hello..

 

How would I get this dropdown menu to carry on doing the task its doing, BUT also get a field of information out of the database a display its result in the dropdown menu therefore the fields of data that have been disabled will display the information without anyone selecting anything from the dropdown menu.

 

  
<?php
$DropDownList .= "<select name='suppname' id='suppname' class='field select medium' onchange='javascript:SelectChanged();'> ".$vbCrLf;
   $DropDownList .= "<option value=''></option> ".$vbCrLf;
   
   while($row = mysql_fetch_row($result))
   {
      $heading = $row[0];
      $DropDownList .= "<option value='$heading'>$heading</option> ".$vbCrLf;
      $Add1ArrayPhp .= 'Add1Array["'.$heading.'"]="'.$row[1].'";'.$vbCrLf;
      $Add2ArrayPhp .= 'Add2Array["'.$heading.'"]="'.$row[2].'";'.$vbCrLf;
      $CityArrayPhp .= 'CityArray["'.$heading.'"]="'.$row[3].'";'.$vbCrLf;
          $RegionArrayPhp .= 'RegionArray["'.$heading.'"]="'.$row[4].'";'.$vbCrLf;
          $PostCodeArrayPhp .= 'PostCodeArray["'.$heading.'"]="'.$row[5].'";'.$vbCrLf;
          $CountryArrayPhp .= 'CountryArray["'.$heading.'"]="'.$row[6].'";'.$vbCrLf;
   }
   $DropDownList .= "</select> ".$vbCrLf;
?>

 

 

Thanks...

Karl

Link to comment
Share on other sites

Hello,

 

The first lot of code is for someone when entering in new contract details, the selection from the dropdown menu is entered into the contracts table as “suppname”.

 

So I have a second form for editing, when I open it up I can see the data that I entered in the first form except for the supplier name which is in the contract database.

 

So when am on the editing form I would like it to get the supplier name and still display the additional fields from the first form.

 

So I have;

Contract_new.php and contract_edit.php

 

I hope that’s a bit clearly.

 

Thanks

Karl

 

Link to comment
Share on other sites

Hello,

 

I have put a mock-up on a free hosting site...

 

http://karl_009.hyperphp.com/main1.php

 

If you click on "Contract New Record" fill out all the details if you dont validation will get you somewhere on the form.

 

All data on that form goes into a table except for  Street Address, Address Line2, City, Region, Postcode, and Country.

 

When you go to edit the form by clicking on Contract Names in the table, the supplier name that was selected when entering the data is not set even though that data is in the database.

 

Now how do you get that to display while displaying the rest of the data from the other table eg... Street Address, Address Line2, City, Region, Postcode, and Country.

 

Thanks

Karl

Link to comment
Share on other sites

Hi

 

Give this a try

 

<?php
require ("include/db_config.php");
$connection = @mysql_connect ($db_host, $db_user, $db_pass) or die ("Error with Connection");
mysql_select_db ($db_name, $connection);

// Init display vars
$dis_suppadd1 = "";
$dis_suppadd2 = "";
$dis_suppcity = "";
$dis_suppregion = "";
$dis_supppostc = "";
$dis_suppcountry = "";

// Get value from address bar
$contid=$_GET['contid'];

// Get data from database
$query = "SELECT * FROM man_contracts WHERE contid='$contid'";
$result = mysql_query ($query);

$rows = mysql_fetch_array ($result);
?>

<?php 
   $vbCrLf = chr(13).chr(10);
   // open connection to MySQL server
   $connection = mysql_connect('localhost', 'root', 'pass')
   or die ('Unable to connect!');
               
   //select database
   mysql_select_db('cmp') or die ('Unable to select database!');
               
   //create and execute query
   $query = 'SELECT suppname, suppadd1, suppadd2, suppcity, suppregion, supppostc, suppcountry FROM man_suppliers ORDER BY suppname';
   $result = mysql_query($query) or die ('Error in query: $query. ' . mysql_error());
               
   //create selection list
   $DropDownList .= "<select name='suppname' id='suppname' class='field select medium' onchange='javascript:SelectChanged();'> ".$vbCrLf;
   $DropDownList .= "<option value=''></option> ".$vbCrLf;
   
   while($row = mysql_fetch_row($result))
   {
      $heading = $row[0];
  if ($heading == $rows['suppname'])
  {
    $DropDownList .= "<option value='$heading' selected='selected'>$heading</option> ".$vbCrLf;
	$dis_suppadd1 = $row[1];
	$dis_suppadd2 = $row[2];
	$dis_suppcity = $row[3];
	$dis_suppregion = $row[4];
	$dis_supppostc = $row[5];
	$dis_suppcountry = $row[6];
  }
  else
  {
    $DropDownList .= "<option value='$heading' >$heading</option> ".$vbCrLf;
  }
      $Add1ArrayPhp .= 'Add1Array["'.$heading.'"]="'.$row[1].'";'.$vbCrLf;
      $Add2ArrayPhp .= 'Add2Array["'.$heading.'"]="'.$row[2].'";'.$vbCrLf;
      $CityArrayPhp .= 'CityArray["'.$heading.'"]="'.$row[3].'";'.$vbCrLf;
  $RegionArrayPhp .= 'RegionArray["'.$heading.'"]="'.$row[4].'";'.$vbCrLf;
  $PostCodeArrayPhp .= 'PostCodeArray["'.$heading.'"]="'.$row[5].'";'.$vbCrLf;
  $CountryArrayPhp .= 'CountryArray["'.$heading.'"]="'.$row[6].'";'.$vbCrLf;	  
   }
   $DropDownList .= "</select> ".$vbCrLf;
?>


<html>
<head>

<title>
Contract Details
</title>

<script language="Javascript" type="text/javascript">
   var Add1Array = new Array();
   <?php echo $Add1ArrayPhp; ?>
   var Add2Array = new Array();
   <?php echo $Add2ArrayPhp; ?>
   var CityArray = new Array();
   <?php echo $CityArrayPhp; ?>
   var RegionArray = new Array();
   <?php echo $RegionArrayPhp; ?>
   var PostCodeArray = new Array();
   <?php echo $PostCodeArrayPhp; ?>
   var CountryArray = new Array();
   <?php echo $CountryArrayPhp; ?>
   function SelectChanged()
   {
      var Company = document.getElementById('suppname').value;
      document.getElementById('suppadd1').value = Add1Array[Company];
      document.getElementById('suppadd2').value = Add2Array[Company];
      document.getElementById('suppcity').value = CityArray[Company];
  document.getElementById('suppregion').value = RegionArray[Company];
  document.getElementById('supppostc').value = PostCodeArray[Company];
  document.getElementById('suppcountry').value = CountryArray[Company];
   }
</script>
</head>

<body id="public">

<img id="top" src="images/top.png" alt="" />
<div id="container">

<form id="contracts" name="contracts" class="" autocomplete="off"
enctype="multipart/form-data" method="post" action="contract_view.php">

<div class="info">
<h2>Contract Details</h2>
<div></div>
</div>

<ul>


<li id="foli1" 		class="   ">
<label class="desc" id="title1" for="Field1">
	Contract Name
			<span id="req_1" class="req">*</span>
		</label>
<div>
	<input id="contname"  name="contname" 	type="text" 	class="field text large" 	value="<?php echo $rows['contname']; ?>" 	maxlength="255" 			tabindex="1" 						/>
		</div>
</li>


<li id="foli3" 		class="   ">
<label class="desc" id="title3" for="Field3">
	Supplier Name
			<span id="req_3" class="req">*</span>
		</label>
<div>
	<?php echo $DropDownList; ?>
</div>
</li>


<li id="foli7" 		class="   ">
<label class="desc" id="title7" for="Field7">
	Type of Contract
			<span id="req_7" class="req">*</span>
	</label>
<div>
  <select id="conttype" 	name="conttype" 	class="field select medium" 	value=""	tabindex="3">
        <option value=""></option>
<option value="Hardware Maintenance" <? if($rows['conttype'] == "Hardware Maintenance") echo "selected"; ?>> Hardware Maintenance </option>
<option value="Software Maintenance" <? if($rows['conttype'] == "Software Maintenance") echo "selected"; ?>> Software Maintenance </option>
<option value="Printing Lease" <? if($rows['conttype'] == "Printing Lease") echo "selected"; ?>> Printing Lease </option>
<option value="Leasing" <? if($rows['conttype'] == "Printing Lease") echo "selected"; ?>> Leasing </option>
<option value="Location" <? if($rows['conttype'] == "Printing Lease") echo "selected"; ?>> Location </option>

        
      </select>
</div>
</li>


<li id="foli9" 		class="   ">
<label class="desc" id="title9" for="Field9">
	Status
			<span id="req_9" class="req">*</span>
	</label>
<div>
	<select id="contstatus" 	name="contstatus" 	class="field select medium"		value="<?php echo $rows['contstatus']; ?>" 	tabindex="4"> 
        	<option value=""><?php echo $rows['contstatus']; ?></option>
		<option value="Awaiting Approval">Awaiting Approval</option>
		<option value="Active">Active</option>
		<option value="Expired">Expired</option>
	</select>
</div>
</li>


<li id="foli11" 
	class="   ">


<label class="desc" id="title11" for="Field11">
	Contract Notes
		</label>

<div>
		<textarea id="contnotes" 
		name="contnotes" 
		class="field textarea medium"
		rows="10" cols="50"
		tabindex="5">
            <?php echo $rows['contnotes']; ?>
            </textarea>

		</div>
            
</li>
    
<li id="foli12" 		class="   ">
<label class="desc" id="title12" for="Field12">
	Start Date
		</label>
<span>
	<input id="contsd" 	name="contsd" 	type="text" 	class="field text" 	value="<?php echo $rows['contsd']; ?>" 	size="2" 	maxlength="2" 			tabindex="6" 			/> /
	<label for="param1">DD</label>
</span>
<span>
	<input id="contsm" 	name="contsm" 	type="text"  	class="field text" 	value="<?php echo $rows['contsm']; ?>" 	size="2" 	maxlength="2" 			tabindex="7" 			/> /
	<label for="param2">MM</label>
</span>
<span>
 	<input id="contsy" 	name="contsy" 	type="text" 	class="field text" 	value="<?php echo $rows['contsy']; ?>" 	size="4" 	maxlength="4" 			tabindex="8" 			/>
	<label for="param3">YYYY</label>
</span>
</li>

<li id="foli13" 		class="   ">
<label class="desc" id="title13" for="Field13">
	End Date
			<span id="req_13" class="req">*</span>
		</label>
<span>
	<input id="conted" 	name="conted" 	type="text" 	class="field text" 	value="<?php echo $rows['conted']; ?>" 	size="2" 	maxlength="2" 			tabindex="9" 			/> /
	<label for="Field13-1">DD</label>
</span>
<span>
	<input id="contem" 	name="contem" 	type="text" 	class="field text" 	value="<?php echo $rows['contem']; ?>" 	size="2" 	maxlength="2" 			tabindex="10" 			/> /
	<label for="Field13-2">MM</label>
</span>
<span>
 	<input id="contey" 	name="contey" 	type="text" 	class="field text" 	value="<?php echo $rows['contey']; ?>" 	size="4" 	maxlength="4" 			tabindex="11" 			/>
	<label for="Field13">YYYY</label>
</span>
</li>


<li id="foli14" 		class="   ">
<label class="desc" id="title14" for="Field14">
	Address
		</label>
<div class="column">
	<span class="full">
	<input id="suppadd1" 	name="suppadd1" 	type="text" 	class="field text addr" 	value="<?php echo $dis_suppadd1; ?>" 	tabindex="12"	disabled 	/>
	<label for="Field14">Street Address</label>
	</span>
	<span class="full">
	<input id="suppadd2" 	name="suppadd2" 	type="text" 	class="field text addr" 	value="<?php echo $dis_suppadd2; ?>" 	tabindex="13"	disabled 	/>
	<label for="Field15">Address Line 2</label>
	</span>
	<span class="left">
	<input id="suppcity" 	name="suppcity" 	type="text" 	class="field text addr" 	value="<?php echo $dis_suppcity; ?>" 	tabindex="14"	disabled 	/>
	<label for="Field16">City</label>
	</span>
	<span class="right">
	<input id="suppregion" 	name="suppregion" 	type="text" 	class="field text addr" 	value="<?php echo $dis_suppregion; ?>" 	tabindex="15"	disabled 	/>
	<label for="Field17">State / Province / Region</label>
	</span>
	<span class="left">
	<input id="supppostc" 	name="supppostc" 	type="text" 	class="field text addr" 	value="<?php echo $dis_supppostc; ?>" 	tabindex="16"	disabled 	/>
	<label for="Field18">Postal / Zip Code</label>
	</span>
	<span class="right">
        <input id="suppcountry" 	name="suppcountry" 	type="text" 	class="field text addr" 	value="<?php echo $dis_suppcountry; ?>" 	tabindex="17"	disabled 	/>
	<label for="Field19">Country</label>
	</span>
</div>
</li>


<li id="foli20" 		class="   ">
<div class="column">
<label class="desc" id="title20" for="Field20">
	Cost / Cost Duration
</label>
            
<span class="symbol">£</span>
<span>
	<input id="contcospo" 	name="contcospo" 	type="text" 	class="field text" 	value="<?php echo $rows['contcospo']; ?>" 	size="4"	maxlength="4" 	tabindex="18" 	/> .	<label for="Field20">Pounds</label>
</span>
     
<span>
	<input id="contcospe" 	name="contcospe" 	type="text" 	class="field text" 	value="<?php echo $rows['contcospe']; ?>" 	size="2" 	maxlength="2" 	tabindex="19" 	/>
	<label for="Field20-1">Pence</label>
</span>
    
    <span class="right">
	<select id="contcosps" 	name="contcosps" 	class="field select large"	value="<?php echo $rows['contcosps']; ?>" 	tabindex="20"> 
        	<option value=""><?php echo $rows['contcosps']; ?> </option>
		<option value="Weekly" >Weekly</option>
		<option value="Monthly">Monthly</option>
		<option value="Yearly">Yearly</option>
        </select>
        <label for="Field17">Duration</label>
    </span>
    </div>
</li>

<li class="buttons">
			<input id="saveForm" class="" type="Submit" value="Main Contracts"  />
		    <input type="hidden" value="<?php echo $rows['contid']; ?>" name="contid" id="contid">
                <input type="hidden" value="TURE" name="submitted">
		</li>

<li style="display:none">
	<label for="comment">Do Not Fill This Out</label>
	<textarea name="comment" id="comment" rows="1" cols="1"></textarea>
</li>
</ul>
</form>

</div><!--container-->
<img id="bottom" src="images/bottom.png" alt="" />

</body>
</html>

 

That is a quick change.

 

Another option would be to use a windown.onload event to call SelectChanged().

 

All the best

 

Keith

Link to comment
Share on other sites

Sorted...

 

Just added the code below the function and it works great.

 

onload = SelectChanged;

 

 

Thank You for all your help on this.

 

For awhile I didn’t think it would get going.

 

Once again Thanks for all your help kickstart.  :D

 

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.