Ronel Posted March 14, 2022 Share Posted March 14, 2022 <td colspan="2"><input type="date" name="date_encode" style="width:100%" value="'.$date_encode.'" /></td> Quote Link to comment https://forums.phpfreaks.com/topic/314596-how-to-insert-auto-current-date-inside-this-tag-please-help/ Share on other sites More sharing options...
gw1500se Posted March 14, 2022 Share Posted March 14, 2022 Depends on what format you want but for mm/dd/yyyy use: <?php echo "<td colspan=\"2\"><input type=\"date\" name=\"date_encode\" style=\"width:100%\" value=\"".date("m/d/Y")."\" /></td>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/314596-how-to-insert-auto-current-date-inside-this-tag-please-help/#findComment-1594383 Share on other sites More sharing options...
Ronel Posted March 15, 2022 Author Share Posted March 15, 2022 $outgoing_date = "CURRENT_DATE()"; $outgoing_date = date("Y-m-d", strtotime($_POST['outgoing_date'])); HOW ABOUT PASSING IT THROUGH THIS? THEN I NEED TO PASS IT THROUGH INPUT TYPE WHICH IS INSIDE TD TAG Quote Link to comment https://forums.phpfreaks.com/topic/314596-how-to-insert-auto-current-date-inside-this-tag-please-help/#findComment-1594397 Share on other sites More sharing options...
ginerjm Posted March 15, 2022 Share Posted March 15, 2022 No I don't think that will work. Perhaps you can see what the errors are if you LOOK at it a bit longer. The very first response to this topic was truly exactly what you asked for though. Although I don't know what you meant by using the word "AUTO" in your request. Quote Link to comment https://forums.phpfreaks.com/topic/314596-how-to-insert-auto-current-date-inside-this-tag-please-help/#findComment-1594400 Share on other sites More sharing options...
ginerjm Posted March 15, 2022 Share Posted March 15, 2022 Here is what you should see if you actually tried out your code like this: $outgoing_date = "CURRENT_DATE()"; echo "1. outgoing_date: $outgoing_date<br>"; $outgoing_date = date("Y-m-d", strtotime($_POST['outgoing_date'])); echo "2. outgoing_date: $outgoing_date<br>"; And the output of this: 1. outgoing_date: CURRENT_DATE() Notice: Undefined index: outgoing_date in /home/albany/public_html/homejg/test.php on line 19 2. outgoing_date: 1969-12-31 (Line 19 is line 3 in my above code) Quote Link to comment https://forums.phpfreaks.com/topic/314596-how-to-insert-auto-current-date-inside-this-tag-please-help/#findComment-1594402 Share on other sites More sharing options...
Barand Posted March 15, 2022 Share Posted March 15, 2022 15 hours ago, Ronel said: $outgoing_date = "CURRENT_DATE()"; $outgoing_date = date("Y-m-d", strtotime($_POST['outgoing_date'])); HOW ABOUT PASSING IT THROUGH THIS? THEN I NEED TO PASS IT THROUGH INPUT TYPE WHICH IS INSIDE TD TAG The biggest obstacle to that approach is that PHP does not have a CURRENT_DATE() function - it's a MySql function. If you had error reporting on, or used the reference manual, that would have given you a clue. date('Y-m-d') will use the current date by default so all the extra code above is redundant - which takes us back to the original solution you were given, yet ignored. 1 Quote Link to comment https://forums.phpfreaks.com/topic/314596-how-to-insert-auto-current-date-inside-this-tag-please-help/#findComment-1594403 Share on other sites More sharing options...
Ronel Posted March 16, 2022 Author Share Posted March 16, 2022 okay i have went through the reference manual and solved it sir Quote Link to comment https://forums.phpfreaks.com/topic/314596-how-to-insert-auto-current-date-inside-this-tag-please-help/#findComment-1594404 Share on other sites More sharing options...
ginerjm Posted March 16, 2022 Share Posted March 16, 2022 People usually post their 'fixed' code for others to see if they have a similar problem..... Quote Link to comment https://forums.phpfreaks.com/topic/314596-how-to-insert-auto-current-date-inside-this-tag-please-help/#findComment-1594407 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.