Jump to content

swoop180570

Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

swoop180570's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. First of all I have set the date from today into the input fields by using the parameter $today = date ('d-m-Y'). The date of today will be added to both the input fields so the user knows how the input must be. I have also added a check into the script when the $days is smaller than 0 a error appears.
  2. Thnx for your input hitman6003, I have replaced the previous code with your code and it is working fine. I'm verry happy with your solution.
  3. Dear hax, I have been testing your example, but I got the "error" from your echo on line 11 when I input the dates and Submit it. I have tried serveral date stamps like dd-mm-yyyy or yyyy-mm-dd. In The Netherlands we use the date in this format (dd-mm-yyyy). Can you tell me what the correct input date is so I can test your example again.   
  4. Hello php colleagues, I need a scripts what can calculate the difference between to dates on a users input. The user gives a start date and a end date. On input of end date the result must be the difference between the start and the end date. I know it can be done like this: [code]<?PHP   $date_a = strtotime("2006-07-10"); $date_b = strtotime("2006-07-23"); $days = ($date_b - $date_a) / (60*60*24); echo number_format($days); ?>[/code] This is just done by using to dates that are already known. I think the variables of $date_a and $date_b must be something like $date_a = $_POST[date1]; where date1 is the name of the input field. Can someone help me out here? I have a script already how it must be. It must be looking like this; [code]<?PHP // *** Defineren van POST input fields *** $date1 = $_POST[date1]; $date2 = $_POST[date1]; // *** Defineren van datum vandaag *** $datenow = date('d-m-Y'); $result = "$datum1" - "$datum2"; ?> <form id="form1" name="form1" method="post" action="">   Start Date:   <label>   <input name="date1" type="text" id="date1" value="<?PHP echo "$datenow"?>" size="8" maxlength="10" />   </label>   End date:   <input name="date2" type="text" id="date2" value="<?PHP echo "$datenow"?>" size="8" maxlength="10" /> Total day's: <?=$result?> </form>[/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.