I have a PHP variable I want to add in Javascript, the problem is it's not getting the variable, please help I'm new to javascript. Sorry I think I did not explain very good.
At the moment I have three select boxes displaying Year, month, date the value of $row_info['birth'] is 2011-04-01. When I apply date to defaultDate: the value is not in there.
<?php
$date = $row_info['birth'];
echo("<script type='text/javascript'>
");
echo("date = '{$row_info['birth']}';
");
echo("</script>");
?>
<script type="text/javascript">
$(document).ready(function(){
$("#picker3").birthdaypicker({
dateFormat: "bigEndian",
monthFormat: "short",
placeholder: false,
defaultDate: date,
hiddenDate: true
});
});
</script>
I would really appreciate some help, thanks
<?php
$date = $row_info['birth'];
echo("<script type='text/javascript'>
");
echo("date = '{".$row_info['birth']."}';
");
echo("</script>");
?>
<script type="text/javascript">
$("#picker3").birthdaypicker({
dateFormat: "bigEndian",
monthFormat: "short",
placeholder: false,
defaultDate: date,
hiddenDate: true
});
});
</script>
<script type="text/javascript">
date = <?php echo $row_info['birth'];?>;
$("#picker3").birthdaypicker({
dateFormat: "bigEndian",
monthFormat: "short",
placeholder: false,
defaultDate: date,
hiddenDate: true
});
});
</script>