Hey all,

I've recently started developing in PHP/MySQL including JavaScript. I had a date/time picker earlier and then inserted some auto insert code which pulls out data from phpMyAdmin and gives the user recommendations of what they might be wanting to insert.

Since I added the auto insert code my date/time picker has decided to stop working. I was wondering if anyone could tell me what I'm doing wrong here.

I'm fairly new to this stuff and I think I've jumped into the deep end of development. I have inserted the code below.

Best Regards,

vinit9

<head>
<title> KPI Test Results Upload </title>
<link rel="stylesheet" type="text/css" href="mystyle.css" />

<script type="text/javascript">
// validation for data entry works on all browsers (means or ||)
function validate(){
if(
document.getElementById('kpi_test_id').value.trim() === "" ||
document.getElementById('device_name').value.trim() === "" ||
document.getElementById('build').value.trim() === "" ||
document.getElementById('datetime').value.trim() === "" ||
document.getElementById('final_outcome').value.trim() === ""

)
{
alert("Please fill out all fields before clicking submit!");
return false;
}
}
</script>

<!-- Time picker script-->

<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/hot-sneaks/jquery-ui.css" />
<script src="jquery-ui-timepicker-addon.js"></script>

<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.16/themes/hot-sneaks/jquery-ui.css" />
<script src="jquery-ui-timepicker-addon.js"></script>

<style>
/* css for timepicker */
.ui-timepicker-div .ui-widget-header{ margin-bottom: 8px; }
.ui-timepicker-div dl{ text-align: left; }
.ui-timepicker-div dl dt{ height: 25px; }
.ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; }
.ui-timepicker-div td { font-size: 90%; }

</style>

<script>

$(function () { $('#selectedDateTime').datetimepicker(); });

</script>

<!-- Auto complete script-->

<script type="text/javascript" src="jquery-autocomplete/lib/jquery.js"></script>
<script type='text/javascript' src='jquery-autocomplete/jquery.autocomplete.js'></script>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />

<script type="text/javascript">
$().ready(function() {
$("#device_name").autocomplete("getDeviceName.php", {
width: 460,
matchContains: true,
selectFirst: false
});
});

</script>

<script type="text/javascript">
$().ready(function() {
$("#build").autocomplete("getBuildAC.php", {
width: 460,
matchContains: true,
selectFirst: false
});
});

</script>


</head>

<?php include('config.php'); ?>

<?php
$db_name="mogadishu"; // Database name
$tbl_name="kpi_tests"; // Table name

// Connect to server and select database.
mysql_select_db("$db_name")or die("cannot select DB");

$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>

<td>
<table width="95%" border="1" cellspacing="3" cellpadding="3" >
<tr>
<a href="index.xhtml"> Homepage</a> <br/>
<p> Current Tests in Database </p>

<!--displays the test cases currently stored in the database-->

<h1> KPI Database </h1>
</tr>

<tr>
<td align="center"><strong>Test ID:</strong></td>
<td align="center"><strong>Test Set Name:</strong></td>
<td align="center"><strong>Test Description:</strong></td>
<td align="center"><strong>Expected Outcome:</strong></td>
<td align="center"><strong>Optional Information:</strong></td>
</tr>

<?php
while($rows=mysql_fetch_array($result)){
?>

<tr>
<td><?php echo $rows['id']; ?></td>
<td><?php echo $rows['test_set_name']; ?></td>
<td><?php echo $rows['test_description']; ?></td>
<td><?php echo $rows['expected_outcome']; ?></td>
<td><?php echo $rows['test_optional']; ?></td>
</tr>

<?php
}
?>

<!--Pop up window script-->
<script type="text/javascript">
<!--
var stile = "top=10, left=10, width=600, height=290 status=no, menubar=no, toolbar=no scrollbar=no";
function Popup(apri) {
window.open(apri, "", stile);
}
</script>

</table>
</td>
</tr>
</table>

<p> If test is not in the database please <a href="javascript:Popup('upload_kpi_test.php')">click here</a> to add.
After adding please refresh page </p>


<body>

<form action="kpi_resultsprocess.php" method="post" name="KPI Results Form">

<fieldset>
<legend><b>Test Details:</b></legend>
<p> Please pick a test from the above table and insert the relevant Test ID. </p>

<h5> Mandatory fields * </h5>

<label for="kpi_test_id">Test ID:* </label>
<?php

$sql = "SELECT DISTINCT id FROM kpi_tests";
$result = mysql_query($sql);

echo "<select name='id'>";
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['id'] . "'>" . $row['id'] . "</option>";
}
echo "</select>";

?><br />

<label for="device_name">Device Name:* </label><br />
<input type="text" name="device_name" id="device_name" /><br />

<label for="build">Build:*</label><br />
<input type="text" name="build" id="build" /><br />

<label for="selectedDateTime">Date and Time of Test: </label><br />
<input type="text" name="selectedDateTime" id="selectedDateTime" /> <br />


<label for="final_outcome">Final Outcome:*</label><br />
<input type="text" name="final_outcome" id="final_outcome" /><br />


</fieldset>
<input type="submit" name="mysubmit" value="Submit" />
<input type ="reset" name="reset" value="Reset Form"/>
</form>

</body>
</html>

<?php
mysql_close();
?>