need help with date function
Posted on
16th Feb 2014 07:03 pm by
admin
i have following form for date
Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="post" action="date.php">
<label>Date:
<select name="day" id="day">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</label>
-
<label>
<select name="month" id="month">
<option value="1">Jan</option>
<option value="2">Feb</option>
<option value="3">Mar</option>
<option value="4">Apr</option>
<option value="5">May</option>
</select>
</label>
-
<label>
<select name="year" id="year">
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
</select>
</label>
<p>
<label>
<input type="submit" name="button" id="button" value="Submit">
</label>
</p>
</form>
</body>
</html>
and here is the php page
Code: <?php
$day = $_POST["day"];
$month = $_POST["month"];
$year = $_POST["year"];
$date = date($day." ".$month." ".$year);
//$date = date("Y m d");
echo $date;
$db = mysql_connect("localhost");
mysql_select_db("test", $db);
$query = "insert into date
(
date
)
values
(
'".$date."'
)";
//echo $query;
$result = mysql_query($query) or die(mysql_error());
echo "your date is added";
?>
when i select any date from form and press submit button it adds only this 0000-00-00 to my table. i want date to be inserted to my table not 0s. how can i solve this problem
No comments posted yet
Your Answer:
Login to answer
78
11
Other forums
Results from Db outputted twice
Hey guys.. for come reason my data is outputted twise shown in the image below and i cant figure out
square instead of number
Hello
I do not know why but this code seems to work fine only in my xampp local insallation but n
date function help
i need help with date function
Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD H
email form (cannot find the problem)
Hello there. I've been having trouble with an email form. Can't find the problem really. I've tested
Setting a default timezone?
I have read about how to change the timezone in PHPMYADMIN, but it changes back, it doesn't STAY the
rename the file
File.txt
Code: ***DOCUMENT***
..DN:
000044255
..CB:
..SN:
..PY:
2009
..E
Code error with Index.php
Error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/runevid/public_
Need help/w Page: 1,2,3,4 function!
So I have this code im working on where it's ment to display seperate pages having 20 logs each
I
Re-Order by ID Number
I have a cms set up for inputting an image, thumb, title, pdf, and eps. When input the database ass
MS Access data into a html table
Hi everyone, I am quite a novice at php but I have created some helpful scripts that fetch data
f