Rufus_84
-
Posts
3 -
Joined
-
Last visited
Posts posted by Rufus_84
-
-
when i echo $dat1 and dat2 i get nothing- blank page.
Anyway I resolved the problem. All i had to do was change the jQuery output date format to yy-mm-dd.
:-)
-
Hello.
I'm new to php and I've been working on calculating the difference of two dates picked by using a jQuery datepicker and i cannot get it work.
My code is:
$date1 = ($_POST['date1']);
$date2 = ($_POST['date2']);
$hour1 = ($_POST['hour1']);
$hour2 = ($_POST['hour2']);
$min1 = ($_POST['min1']);
$min2 = ($_POST['min2']);
$dat1 = $date1." ".$hour1.":".$min1;
$dat2 = $date2." ".$hour2.":".$min2;
$start = strtotime($dat1));
$end = strtotime($dat2));
$date_diff = $end - $start;
$days = ceil($date_diff/3600/24);
echo $days
The code seems to be correct, because when I'm not using the datepicker, but typing the dates in manually it shows the number of days. However when I use the datepicker it posts the dates which I checked by adding "echo $dat1 and echo $dat2" but it's not showing the amount of days at all.
I'd really appreciate if anyone could help me with this.
Thanks a lot.
Raf
search an array using search box (no database)
in PHP Coding Help
Posted
Hello.
I was wandering whether I can search an array for example $films = array ('Madagascar' => 'madagascar',
'Ice Age' => 'ice_age',
'Shrek' => 'shrek')
and display the result using while for example while(list($title, $link)=each($films){
echo "<a href=\"$link\">$title</a><br/>";}
so the result is a link to a page with the movie?
Can I do it without database?
appretiate any help
Rafal