Solved

PHP Code

Posted on 2014-07-22
4
384 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
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 …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

730 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