multichild
04-27-2012, 01:34 PM
Hello,
Im building a CMS and one of the parts needs a date calendar so the user can input the start and end date of contracts.
Im using one of the tools from this site which is Jason's Date Input Calendar and have posted the code below for you to see how its currently being used.
<script type="text/javascript" src="calendarDateInput.js">
<script>DateInput('dateoriginal', true, 'YYYY-MM-DD')</script>
All works fine, but I am trying to do is get the date to change when the client tries to edit this contract, to reflect the date that has been set in the database.
So I was thinking something like this, but its not working:
<script>DateInput('dateoriginal', true, 'YYYY-MM-DD', '<?php $cStart; ?>')</script>
$cEnd is the variable for the corresponding field, and its a MSSQL database and the datetime field is set as YYYY-MM-DD
I just tried also to echo the date out of the database and it wont do it, so do I need to sort of get the code right first to handle a date before displaying it.
This is how my PHP looks and im using a MSSQL database.
$queryEdit="select * from CSF_Intranet where Contract_Number=$customer_Number";
$rowsEdit = sqlsrv_query($conn, $queryEdit);
while ($rows = sqlsrv_fetch_array($rowsEdit, SQLSRV_FETCH_ASSOC)) {
$cStart=$rows["Contract_Start"];
Cheers
Im building a CMS and one of the parts needs a date calendar so the user can input the start and end date of contracts.
Im using one of the tools from this site which is Jason's Date Input Calendar and have posted the code below for you to see how its currently being used.
<script type="text/javascript" src="calendarDateInput.js">
<script>DateInput('dateoriginal', true, 'YYYY-MM-DD')</script>
All works fine, but I am trying to do is get the date to change when the client tries to edit this contract, to reflect the date that has been set in the database.
So I was thinking something like this, but its not working:
<script>DateInput('dateoriginal', true, 'YYYY-MM-DD', '<?php $cStart; ?>')</script>
$cEnd is the variable for the corresponding field, and its a MSSQL database and the datetime field is set as YYYY-MM-DD
I just tried also to echo the date out of the database and it wont do it, so do I need to sort of get the code right first to handle a date before displaying it.
This is how my PHP looks and im using a MSSQL database.
$queryEdit="select * from CSF_Intranet where Contract_Number=$customer_Number";
$rowsEdit = sqlsrv_query($conn, $queryEdit);
while ($rows = sqlsrv_fetch_array($rowsEdit, SQLSRV_FETCH_ASSOC)) {
$cStart=$rows["Contract_Start"];
Cheers