Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74433

How to sync two date fields input. A drift, need some guidance

$
0
0

I am creating a form using html and php, inside this form I have date input "from" and date input "to". How can "to" get update with the date I select in "from"? For example, if I select in the "from" July 1st, I want "to" to get update with the same date or the next day.

This is my form:

<?php ob_start() ?>
<?php if(isset($params['message'])) :?>
    <b><span style="color: red;"><?php echo $params['message'] ?></span></b>
<?php endif; ?>
<?php
    date_default_timezone_set('America/Costa_Rica');
?>
<br/>
<form name="formInsertDocument" action="index.php?ctl=insertDocument" autocomplete="off" method="POST">
    <h2>Insert New Document</h2>
    <fieldset>
        <ul>
            <li>
                <label for="name">Type:</label>
                <input type="number" name="id_type" required value="<?php echo $params['id_type'] ?>" />
            </li>
            <li>
                <label for="name">Client:</label>
                <input type="number" name="id_client" required value="<?php echo $params['id_client'] ?>" />
            </li>
            <li>
                <label for="name">Date:</label>
                <input type="date" name="date_document" required value="<?php echo date('Y-m-d'); ?>" value="<?php echo $params['date_document'] ?>" />
            </li>
            <li>
                <label for="name">Arrival:</label>
                <input type="date" name="date_arrival" required value="<?php echo date('Y-m-d'); ?>" value="<?php echo $params['date_arrival'] ?>" />
            </li>
            <li>
                <label for="name">Departure:</label>
                <input type="date" name="date_leaving" required value="<?php echo date('Y-m-d'); ?>" value="<?php echo $params['date_leaving'] ?>" />
            </li>
            <li>
                <label for="name">Subtotal:</label>
                <input type="number" name="subtotal" required value="<?php echo $params['subtotal'] ?>" />
            </li>
            <li>
                <label for="name">Taxable:</label>
                <input type="number" name="taxable" required value=00000000 value="<?php echo $params['taxable'] ?>" />
            </li>
            <li>
                <label for="name">Tax:</label>
                <input type="number" name="tax" value=00000000 value="<?php echo $params['tax'] ?>" />
            </li>
            <li>
                <label for="name">Other:</label>
                <input type="number" name="other" required value="<?php echo $params['other'] ?>" />
            </li>
            <li>
                <label for="name">Total:</label>
                <input type="number" name="total" required value=0 value="<?php echo $params['total'] ?>" />
            </li>
        </ul>
    </fieldset>
    <input type="submit" value="Insert" name="insert" />
</form>
<?php $contenido = ob_get_clean() ?>
<?php include '../app/templates/layout.php' ?>

Viewing all articles
Browse latest Browse all 74433

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>