Hi I'm trying use a datepicker on a field I have. I'm trying to set the date field up so the user can only edit this field if the date value in the database is set to deafault (0000-00-00). If there is a value that's not equal to default I want to show the date created.
Here's the code I have attempted:
if( $post['Date'] = var_dump(checkdate(00, 00, 0000))){
echo "<input type=\"text\" class=\"datepicker\" name=\"pDate\" style=\"border:#000099; margin:10px;\" value=\"";
echo $post['Date'];
echo "\"> <input id=\"start_dt\" class=\"datepicker\">";
}
if( $post['Date'] != var_dump(checkdate(00, 00, 0000))){
echo "<span>date created: </span>";
echo $post['Date'];
}
It's not working atm so any help or a point in the right direction would be great. Please also take into account I haven't added any proper styling so I'm only after help with the functionality.
Many thanks.
var_dump()does not do what you think it does.var_dumpis for debug-outputting variables and does not return anything. So with$post['Date'] = var_dump(...)you are assigningnullto$post['Date']andnullevaluates tofalse, so your condition is never met.$post