0

I see a few similar questions on the forums, but I can't seem to find one that relates.

I have a form that submits date and time values in a specific format to the server. Then, I have a page that retrieves these values, among others, from the server and places them into a different form (that's exactly the same as the first) so the values can be edited and resubmitted to the server.

I need the values to be in the specific format because on submit the form also generates multiple PDF documents which require the formatting I've selected.

Here's the form fields grabbing the info from the server:

<div class="col">
    <input type="date" name="inspectionDate" class="form-control" placeholder="Inspection Date" value="<? 
    php echo escape($row['inspectionDate']);?>">
</div>

<div class="col">
    <input type="time" name="inspectionTime" class="form-control" placeholder="Inspection Time" value=" 
    <?php echo escape($row['inspectionTime']);?>">
</div>

Here's the error I'm getting:

The specified value "04/12/21" does not conform to the required format, "yyyy-MM-dd".

The specified value "12:30 pm" does not conform to the required format. The format is "HH:mm", "HH:mm:ss" or "HH:mm:ss.SSS" where HH is 00-23, mm is 00-59, ss is 00-59, and SSS is 000-999.

I tried to set the date format at the top of the page like I did to get it in this format it the first place, but that doesn't seem to do anything.

Please let me know if you guys have any insight.

EDIT

Below you'll find the 'escape' function which grabs the data from the server and needs to be used.

How would I add a second function to this field that uses strtotime?

function escape($html) {
    return htmlspecialchars($html, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8"); 
};

0 Answers0