Good Morning,

I am after some help, I am still fairly new to php development so apologies if this one has been answered before,

I have been tasked to build an email migration tracker that automates emails, this part I think I have covered, one part I am not sure with and would love some guidance is the form has checkboxes (check list) which when they are ticked I need the current date to be populated in the textbox next to them, in the correct date format, is there any way in php this can be done, any advice would be much appreciated

Cheers
Martin

This is done using JavaScript not PHP. It is "client-side" scripting/programming.

Thanks,

Have you got any ideas how this can be done

I use jQuery (a JavaScript library). Can you provide the FORM code ?

I'm afraid not havn't built the code yet I hoping to get this done later on today

To get you started...

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Test</title>
</head>
<body>
<form id="js-tracker-form" name="tracker" action="/tracker" method="POST">
    <p><input type="checkbox" name="check1" value="1"> <input type="text" name="check1date" value=""></p>
    <p><input type="checkbox" name="check2" value="1"> <input type="text" name="check2date" value=""></p>
    <p><input type="checkbox" name="check3" value="1"> <input type="text" name="check3date" value=""></p>
    <p><input type="submit" name="submit" value="Submit"></p>
</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>
    var today = new Date();
    $("#js-tracker-form").on("click","input[type=checkbox]",function(){
        if($(this).prop("checked")) {
            //the actual checking of the element beats this event handler
            $(this).next().val(today.toDateString());
        } else {
            $(this).next().val('');
        }
    });
</script>
</body>
</html>

JavaScript Date

Great thanks very much for this works a dream, I will be able to inplement this into my code, is there anyway of displaying the date in 10/10/2013 formate at all?

That's what the bottom link is for ;-)

Great thanks sorry missed that one, thanks again for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.