Solved

PHP Code

Posted on 2014-07-22
4
385 Views
Last Modified: 2014-07-22
The code below works great but I do have one question about it. Is there any way for me to edit the code

<p><b>Date Completed:</b> <br> <input type="date" name="datepicker_comp" id="datepicker_comp" size="15" value = "YYYY-MM-DD"/></p>

So instead of showing the value of YYYY-MM-DD, it will echo or show today's date 2014-07-22?

The entire code snip it is below & the line of code in question is on line 11.

<?php

echo '<form action="complete.php" method="post">

<fieldset><legend><h2>If you have completed this assignment, click "Complete Task" below.</h2></legend>

<b>Place No:</b> <br><input type="text" name="place" size="15" maxlength="30" value="'.$row[0].'" /><br>
<b>Name:</b> <br><input type="text" name="name" size="35" maxlength="30" value="'.$row[1].'" /><br />
<b>Task:</b><br><input type="text" name="task" size="45" maxlength="35" value="'.$row[2].'" onchange="checkme()"/> <br>
<b>Date Due:</b><br><input type="text" name="datepicker" size="15" maxlength="30" value="'.$row[3].'" onchange="checkme()"/> <br>
<p><b>Date Completed:</b> <br> <input type="date" name="datepicker_comp" id="datepicker_comp" size="15" value = "YYYY-MM-DD"/></p>
<b>Employee:</b><br><input type="text" name="your_name" size="35" maxlength="30" value="'.$row[4].'" onchange="checkme()"/> <br>
</fieldset>

<div align="left"><input type="submit" name="submit" value="Complete Task" /></div> 

<input type="hidden" name="submitted" value="TRUE" />
<input type="hidden" name="id" value="' . $id . '" />
</form>';

} else { // Not a valid user ID.
	echo '<h1 id="mainhead">Page Error</h1>
	<p class="error">This page has been accessed in error.</p><p><br /><br /></p>';
}

mysql_close(); // Close the database connection.

?>

Open in new window

0
Comment
Question by:wantabe2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Expert Comment

by:N R
ID: 40212760
Sure use this for the value
date('Y-m-d');

Open in new window

0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40212763
just replace:
value = "YYYY-MM-DD"

by:
value = "<?php echo date(""Y-m-d"); ?>"
0
 
LVL 15

Author Comment

by:wantabe2
ID: 40212784
If I use:

<p><b>Date Completed:</b> <br> <input type="date" name="datepicker_comp" id="datepicker_comp" size="35" value = "<?php echo date(""Y-m-d"); ?>" </p>

Open in new window


I get the attached showing on the form...& it does not work
Capture.JPG
0
 
LVL 11

Accepted Solution

by:
N R earned 500 total points
ID: 40212787
Looks like you're already echoing out so use:

value = "'.date('Y-m-d').'"

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question