Du for lige alt koden.
________________________________________________________________
<?php require_once('Connections/Intranet.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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']);
}
$str1= $_POST['Emne'];
$str3= $_POST['Hus_adresse'];
$str4= $_POST['Tilhoersforhold[]'];
$str5= $_POST['Arb_rekk_nr'];
$str6= $_POST['Dato_start'];
$str7= $_POST['Dato_slut'];
$str8= $_POST['Kommentar'];
$str9= $_POST['Status'];
$str10= $_POST['Postnummer'];
$str11= $_POST['Bynavn'];
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "WADAInsertForm")) {
$insertSQL = sprintf
("INSERT INTO service_afdelingen_opgaver (Emne, Hus_adresse, Tilhoersforhold, Arb_rekk_nr, Dato_Start, Dato_Slut, Kommentar, Status, Hus_Postnummer, Hus_By) VALUES ('$str1', '$str3', '$streng', '$str5', '$str6', '$str7', '$str8', '$str9', '$str10', '$str11')"
);
mysql_select_db($database_Intranet, $Intranet);
$Result1 = mysql_query($insertSQL, $Intranet) or die(mysql_error());
header( 'Location: opgaver_visning.php' ) ;
}
?>
<?php
$maxRows_WADADynListhuse_adresse = 1000;
$pageNum_WADADynListhuse_adresse = 0;
if (isset($_GET['pageNum_WADADynListhuse_adresse'])) {
$pageNum_WADADynListhuse_adresse = $_GET['pageNum_WADADynListhuse_adresse'];
}
$startRow_WADADynListhuse_adresse = $pageNum_WADADynListhuse_adresse * $maxRows_WADADynListhuse_adresse;
mysql_select_db($database_Intranet, $Intranet);
$query_WADADynListhuse_adresse = "SELECT Hus_adresse, Hus_adresse FROM huse_adresse ORDER BY Hus_Postnummer";
$WADADynListhuse_adresse = mysql_query($query_WADADynListhuse_adresse, $Intranet) or die(mysql_error());
$row_WADADynListhuse_adresse = mysql_fetch_assoc($WADADynListhuse_adresse);
$totalRows_WADADynListhuse_adresse = mysql_num_rows($WADADynListhuse_adresse);
mysql_select_db($database_Intranet, $Intranet);
$query_haandvaarker = "SELECT haandvaarker_afdeling.H_afdeling FROM haandvaarker_afdeling";
$haandvaarker = mysql_query($query_haandvaarker, $Intranet) or die(mysql_error());
$row_haandvaarker = mysql_fetch_assoc($haandvaarker);
$totalRows_haandvaarker = mysql_num_rows($haandvaarker);
mysql_select_db($database_Intranet, $Intranet);
$query_Adresser = "SELECT * FROM huse_adresse";
$Adresser = mysql_query($query_Adresser, $Intranet) or die(mysql_error());
$row_Adresser = mysql_fetch_assoc($Adresser);
$totalRows_Adresser = mysql_num_rows($Adresser);
?>
<?php
// RepeatSelectionCounter_1 Initialization
$RepeatSelectionCounter_1 = 0;
$RepeatSelectionCounterBasedLooping_1 = false;
$RepeatSelectionCounter_1_Iterations = "-1";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="
http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Insert service_afdelingen_opgaver</title>
<link rel="stylesheet" media="all" type="text/css" href="sitesculptor_assets/content/css/content.css" />
<link rel="stylesheet" media="print" type="text/css" href="sitesculptor_assets/content/css/content_print.css" />
<!--[if IE 5]>
<style type="text/css">
/* IE 5 does not use the standard box model, so the column widths are overidden to render the page correctly. */
#outerWrapper #contentWrapper #leftColumn1 {
width: 199px;
}
</style>
<![endif]-->
<!--[if IE]>
<style type="text/css">
/* The proprietary zoom property gives IE the hasLayout property which addresses several bugs. */
#outerWrapper #contentWrapper #content {
zoom: 1;
}
</style>
<![endif]-->
<link href="WA_DataAssist/styles/Ultramodern_Pacifica.css" rel="stylesheet" type="text/css" />
<link href="WA_DataAssist/styles/Arial.css" rel="stylesheet" type="text/css" />
<style type="text/css" media="all">
<!--
@import url("CSSMenuWriter/cssmw_content/menu.css");
-->
</style>
<!--[if lte IE 6]>
<style type="text/css" media="all">
@import url("../CSSMenuWriter/cssmw_content/menu_ie.css");
</style>
<style type="text/css" media="all">
img, div, ul, li, span, a {
behavior: url("../CSSMenuWriter/cssmw_content_images/iepngfix.htc");
}
</style>
<![endif]-->
<script type="text/javascript" src="CSSMenuWriter/cssmw_content/menu.js"></script>
<style type="text/css" media="all">
<!--
@import url("sitesculptor_css/mystyles.css");
-->
</style>
<script type="text/javascript" src="CSSMenuWriter/cssmw/menu.js"></script>
<style type="text/css" media="all">
<!--
@import url("CSSMenuWriter/cssmw/menu.css");
-->
</style>
<!--[if lte IE 6]>
<style type="text/css" media="all">
@import url("../CSSMenuWriter/cssmw/menu_ie.css");
</style>
<![endif]-->
<link type="text/css" href="webassist/datepicker/opgaver_opret_datepicker_1/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="webassist/jquery/jquery.js"></script>
<script type="text/javascript" src="webassist/jquery/jquery-ui.js"></script>
<script type="text/javascript">
$(function(){
$('#Dato_start').datepicker({
dateFormat: 'dd/mm/yy',
showAnim: 'show',
onClose: closeDatePicker_datepicker_1
});
});
function closeDatePicker_datepicker_1() {
var tElm = $('#Dato_start');
if (typeof datepicker_1_Spry != null && typeof datepicker_1_Spry != "undefined") {
datepicker_1_Spry.validate();
}
var docElm = document.getElementById("Dato_start");
var tBlur = docElm.getAttribute("onBlur");
if (!tBlur) tBlur = docElm.getAttribute("onblur");
if (!tBlur) tBlur = docElm.getAttribute("ONBLUR");
if (tBlur) {
tBlur = tBlur.replace(/\bthis\b/g, "docElm");
eval(tBlur);
}
}
</script>
<link type="text/css" href="webassist/datepicker/opgaver_opret_datepicker_5/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="webassist/jquery/jquery.js"></script>
<script type="text/javascript" src="webassist/jquery/jquery-ui.js"></script>
<script type="text/javascript">
$(function(){
$('#Dato_slut').datepicker({
dateFormat: 'dd/mm/yy',
showAnim: 'show',
onClose: closeDatePicker_datepicker_5
});
});
function closeDatePicker_datepicker_5() {
var tElm = $('#Dato_slut');
if (typeof datepicker_5_Spry != null && typeof datepicker_5_Spry != "undefined") {
datepicker_5_Spry.validate();
}
var docElm = document.getElementById("Dato_slut");
var tBlur = docElm.getAttribute("onBlur");
if (!tBlur) tBlur = docElm.getAttribute("onblur");
if (!tBlur) tBlur = docElm.getAttribute("ONBLUR");
if (tBlur) {
tBlur = tBlur.replace(/\bthis\b/g, "docElm");
eval(tBlur);
}
}
</script>
</head>
<body>
<div id="outerWrapper">
<div id="header"><img alt="Logo" src="sitesculptor_assets/content/images/logo.png" />Hey</div>
<div id="topNavigation">
<?php require_once("CSSMenuWriter/cssmw/menu.php"); ?>
<script type="text/javascript">if(window.attachEvent) { window.attachEvent("onload", function() { cssmw_content.intializeMenu('cssmw_content',{select_current: 1, orientation: 1}); }); } else if(window.addEventListener) { window.addEventListener("load", function() { cssmw_content.intializeMenu('cssmw_content',{select_current: 1, orientation: 1}); }, true); }</script></div>
<div id="contentWrapper">
<div id="content">
<div class="WADAInsertContainer">
<form action="<?php echo $editFormAction; ?>" method="POST" name="WADAInsertForm" id="WADAInsertForm">
<div class="WADAHeader"></div>
<table class="WADADataTable" cellpadding="0" cellspacing="0" border="0">
<tr>
<th class="WADADataTableHeader">OpgaverID:</th>
<td class="WADADataTableCell"></td>
</tr>
<tr>
<th class="WADADataTableHeader">Emne:</th>
<td class="WADADataTableCell"><input type="text" name="Emne" id="Emne" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Adresse:</th>
<td class="WADADataTableCell">
<select name="Hus_adresse" id="Hus_adresse">
<?php
do {
?>
<option value="<?php echo $row_WADADynListhuse_adresse['Hus_adresse']?>"><?php echo $row_WADADynListhuse_adresse['Hus_adresse']?></option>
<?php
} while ($row_WADADynListhuse_adresse = mysql_fetch_assoc($WADADynListhuse_adresse));
$rows = mysql_num_rows($WADADynListhuse_adresse);
if($rows > 0) {
mysql_data_seek($WADADynListhuse_adresse, 0);
$row_WADADynListhuse_adresse = mysql_fetch_assoc($WADADynListhuse_adresse);
}
?>
</select>
<tr>
<th class="WADADataTableHeader">Postnummer:</th>
<td class="WADADataTableCell">
<select name="Postnummer">
<?php
do {
?>
<option value="<?php echo $row_Adresser['Hus_Postnummer']?>"><?php echo $row_Adresser['Hus_Postnummer']?></option>
<?php
} while ($row_Adresser = mysql_fetch_assoc($Adresser));
$rows = mysql_num_rows($Adresser);
if($rows > 0) {
mysql_data_seek($Adresser, 0);
$row_Adresser = mysql_fetch_assoc($Adresser);
}
?>
</select>
</td>
</tr>
<tr>
<th class="WADADataTableHeader">By:</th>
<td class="WADADataTableCell">
<select name="Bynavn">
<?php
do {
?>
<option value="<?php echo $row_Adresser['Hus_by']?>"><?php echo $row_Adresser['Hus_by']?></option>
<?php
} while ($row_Adresser = mysql_fetch_assoc($Adresser));
$rows = mysql_num_rows($Adresser);
if($rows > 0) {
mysql_data_seek($Adresser, 0);
$row_Adresser = mysql_fetch_assoc($Adresser);
}
?>
</select>
</td>
</tr>
</td>
</tr>
<tr>
<th class="WADADataTableHeader">Tilhørsforhold:</th>
<td class="WADADataTableCell">
<?php
// RepeatSelectionCounter_1 Begin Loop
$RepeatSelectionCounter_1_IterationsRemaining = $RepeatSelectionCounter_1_Iterations;
while($RepeatSelectionCounter_1_IterationsRemaining--){
if($RepeatSelectionCounterBasedLooping_1 || $row_haandvaarker){
?>
<label>
<input type="checkbox" name="Tilhoersforhold[]" value="<?php echo $row_haandvaarker['H_afdeling']; ?>" id="Tilhoersforhold" />
<?php echo $row_haandvaarker['H_afdeling']; ?> </label>
<br />
<?php
$til = $_POST['Tilhoersforhold'];
$N = count($til);
for($i=0; $i < $N; $i++)
{
echo($til[$i]);
}
$array = array($row_haandvaarker['H_afdeling']);
$streng = implode(", ",$array);
echo $streng;
?>
<?php
} // RepeatSelectionCounter_1 Begin Alternate Content
else{
?>
<?php } // RepeatSelectionCounter_1 End Alternate Content
if(!$RepeatSelectionCounterBasedLooping_1 && $RepeatSelectionCounter_1_IterationsRemaining != 0){
if(!$row_haandvaarker && $RepeatSelectionCounter_1_Iterations == -1){$RepeatSelectionCounter_1_IterationsRemaining = 0;}
$row_haandvaarker = mysql_fetch_assoc($haandvaarker);
}
$RepeatSelectionCounter_1++;
} // RepeatSelectionCounter_1 End Loop
?>
</p></td>
</tr>
<tr>
<th class="WADADataTableHeader">Arbejds Rekvisition Nummer: </th>
<td class="WADADataTableCell"><input type="text" name="Arb_rekk_nr" id="Arb_rekk_nr" value="" size="32" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Dato Start:</th>
<td class="WADADataTableCell"><input id="Dato_start" name="Dato_start" type="text" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Dato Slut:</th>
<td class="WADADataTableCell"><input id="Dato_slut" name="Dato_slut" type="text" /></td>
</tr>
<tr>
<th class="WADADataTableHeader">Status:</th>
<td class="WADADataTableCell">Igangværende
<input type="checkbox" name="Status" id="Status" value="Igangværende" />
<br />
Afventende
<input type="checkbox" name="Status" id="Status" value="Afventende" />
<br />
Afsluttet
<input type="checkbox" name="Status" id="Status" value="Afsluttet" />
</td>
</tr>
<tr>
<th class="WADADataTableHeader">Kommentar:</th>
<td class="WADADataTableCell"><textarea name="Kommentar" id="Kommentar" cols="32"></textarea></td>
</tr>
</table>
<div class="WADAButtonRow">
<table class="WADADataNavButtons" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="WADADataNavButtonCell" nowrap="nowrap"><input type="image" name="Insert" id="Insert" value="Insert" alt="Insert" src="WA_DataAssist/images/Pacifica/Ultramodern_insert.gif" /></td>
<td class="WADADataNavButtonCell" nowrap="nowrap"><span id="Cancel" class="WADATextButton"><a href="opgaver_visning.php">Cancel</a></span></td>
</tr>
</table>
<input name="WADAInsertRecordID" type="hidden" id="WADAInsertRecordID" value="" />
</div>
<input type="hidden" name="MM_insert" value="WADAInsertForm" />
</form>
</div>
</div>
<br class="clearFloat" />
</div>
<div id="footer">lld</div>
</div>
</body>
</html>
<?php
mysql_free_result($WADADynListhuse_adresse);
mysql_free_result($haandvaarker);
mysql_free_result($Adresser);
?>