Jump to content

how to insert auto current date inside this tag please help?


Ronel
 Share

Recommended Posts

$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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

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.

  • Haha 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • 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.