0

I have made a script that gets only friday and puts them in a drop down but now i dont want to upload it into the datbase as a string i need it as timestamp so i can filter and order for current day and such.

here is the form

<?php
echo "<form action='".$_SERVER['php_self']."' method='post'> ";
print "<select name=\"start\" size=\"1\">"; 
print "<option value=\"Select Week\" selected>Select Week</option>"; 
for($i=0; $i<=6; $i++){ 
$num = date("d M Y", strtotime('next friday +'.$i.' week')); 
print"<option value=\"{$num}\">{$num}</option> \n"; 
} 
print "</select>";
echo "<input name='Submit' type='submit' id='start' value='Send Day'>";
echo "</form>";

and here is the upload to database part

$fridate = $_POST['start'];
$create = "INSERT INTO day (day) VALUES ('$fridate')";
$query=mysql_query($create);
if (!$query)
  echo $create."<br />makes an error:<br />".mysql_error();
?>

can anyone please help me to get the timestamp for the day so i can save into the database as date and not string?

2
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by ripper1510
0

I have tried all the ways and havent been able to figure it out can you please help some more and show me(im kinda thick)?

0

Amazing. It works. Thank you very much. I got close

$fridate2 = date('d F Y', strtotime('$fridate'));

You good man.

This site is amazing. The best

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.