PHP - I Think Daylight Savings Time Screwed Up My Little Function
I wrote this bit of code to get the next six datetimes of a certain date. It was working perfectly until this week.
Code: [Select] <?php $start = "2011-11-06"; $num_days = 6; for ($i = 0; $i <= $num_days; $i += 1) { $stamp = strtotime($start) + ($i * 86400); echo date('l - n/d/Y - h:i a',$stamp)."<br/>"; } ?> The 2011-11-06 is a Sunday so i would expect to get the following: Sunday - 11/06/2011 - 12:00 am Monday - 11/07/2011 - 12:00 am Tuesday - 11/08/2011 - 12:00 am Wednesday - 11/09/2011 - 12:00 am Thursday - 11/10/2011 - 12:00 am Friday - 11/11/2011 - 12:00 am Saturday - 11/12/2011 - 12:00 am instead it is producing: Sunday - 11/06/2011 - 12:00 am Sunday - 11/06/2011 - 11:00 pm Monday - 11/07/2011 - 11:00 pm Tuesday - 11/08/2011 - 11:00 pm Wednesday - 11/09/2011 - 11:00 pm Thursday - 11/10/2011 - 11:00 pm Friday - 11/11/2011 - 11:00 pm How should i go about fixing this so it doesn't happen again? Similar TutorialsHey everyone,
So I've been using this code for a while and it may not be the best way of doing things but its worked for me based on my very limited knowledge of PHP. The code is based for a radio station which makes an image change based on the day and time. For some reason though due to daylight savings time ending the code is now off an hour. Whats the best way of fixing this without changing every single number? (Which I actually did try and still seem to be screwing it up) Below is the code:
<p> <?php $h = date('G'); //set variable $h to the hour of the day $d = date('w'); //set variable $d to the day of the week. $year = date('Y'); //set variable $year to the current year // SUNDAY SCHEDULE if ($d == 0 && $h >= 4 && $h < 5) $img = '/images/shows/HughHewitt.png'; else if ($d == 0 && $h >= 5 && $h < 10) $img = '/images/shows/RedEyeRadio.png'; else if ($d == 0 && $h >= 10 && $h < 11) $img = '/images/shows/MomTalk.png'; else if ($d == 0 && $h >= 11 && $h < 12) $img = '/images/shows/GoodParenting.png'; else if ($d == 0 && $h >= 12 && $h < 14) $img = '/images/shows/PetShow.png'; else if ($d == 0 && $h >= 14 && $h < 15) $img = '/images/shows/GardenRebel.png'; else if ($d == 0 && $h >= 15 && $h < 16) $img = '/images/shows/WorkingMother.png'; else if ($d == 0 && $h >= 16 && $h < 17) $img = '/images/shows/WhatsCooking.png'; else if ($d == 0 && $h >= 17 && $h < 18) $img = '/images/shows/HomeWizards.png'; else if ($d == 0 && $h >= 18 && $h < 19) $img = '/images/shows/DougStephan.png'; else if ($d == 0 && $h >= 19 && $h < 20) $img = '/images/shows/Finance.png'; else if ($d == 0 && $h >= 20 && $h < 21) $img = '/images/shows/PopularScience.png'; else if ($d == 0 && $h >= 21 && $h < 22) $img = '/images/shows/ABCRadio.png'; else if ($d == 0 && $h >= 22) $img = '/images/shows/Medicine.png'; else if ($d == 1 && $h >= 0 && $h < 3) $img = '/images/shows/ArmedAmerica.png'; else if ($d == 1 && $h >= 3 && $h < 4) $img = '/images/shows/HughHewitt.png'; // MONDAY SCHEDULE if ($d == 1 && $h >= 4 && $h < 5) $img = '/images/shows/HughHewitt.png'; else if ($d == 1 && $h >= 5 && $h < 10) $img = '/images/shows/RedEyeRadio.png'; else if ($d == 1 && $h >= 10 && $h < 13) $img = '/images/shows/BobRick.png'; else if ($d == 1 && $h >= 13 && $h < 16) $img = '/images/shows/DougStephan.png'; else if ($d == 1 && $h >= 16 && $h < 19) $img = '/images/shows/MariluHenner.png'; else if ($d == 1 && $h >= 19 && $h < 20) $img = '/images/shows/DebbieNigro.png'; else if ($d == 1 && $h >= 20 && $h < 22) $img = '/images/shows/DaveRamsey.png'; else if ($d == 1 && $h >= 22) $img = '/images/shows/JoyBrowne.png'; else if ($d == 2 && $h >= 0 && $h < 1) $img = '/images/shows/ShannonJoy.png'; else if ($d == 2 && $h >= 1 && $h < 2) $img = '/images/shows/BillNojay.png'; else if ($d == 2 && $h >= 2 && $h < 4) $img = '/images/shows/DennisPrager.png'; // TUESDAY SCHEDULE if ($d == 2 && $h >= 4 && $h < 5) $img = '/images/shows/DennisPrager.png'; else if ($d == 2 && $h >= 5 && $h < 10) $img = '/images/shows/RedEyeRadio.png'; else if ($d == 2 && $h >= 10 && $h < 13) $img = '/images/shows/BobRick.png'; else if ($d == 2 && $h >= 13 && $h < 16) $img = '/images/shows/DougStephan.png'; else if ($d == 2 && $h >= 16 && $h < 19) $img = '/images/shows/MariluHenner.png'; else if ($d == 2 && $h >= 19 && $h < 20) $img = '/images/shows/DebbieNigro.png'; else if ($d == 2 && $h >= 20 && $h < 22) $img = '/images/shows/DaveRamsey.png'; else if ($d == 2 && $h >= 22) $img = '/images/shows/JoyBrowne.png'; else if ($d == 3 && $h >= 0 && $h < 1) $img = '/images/shows/ShannonJoy.png'; else if ($d == 3 && $h >= 1 && $h < 2) $img = '/images/shows/BillNojay.png'; else if ($d == 3 && $h >= 2 && $h < 4) $img = '/images/shows/DennisPrager.png'; // WEDNESDAY SCHEDULE if ($d == 3 && $h >= 4 && $h < 5) $img = '/images/shows/DennisPrager.png'; else if ($d == 3 && $h >= 5 && $h < 10) $img = '/images/shows/RedEyeRadio.png'; else if ($d == 3 && $h >= 10 && $h < 13) $img = '/images/shows/BobRick.png'; else if ($d == 3 && $h >= 13 && $h < 16) $img = '/images/shows/DougStephan.png'; else if ($d == 3 && $h >= 16 && $h < 19) $img = '/images/shows/MariluHenner.png'; else if ($d == 3 && $h >= 19 && $h < 20) $img = '/images/shows/DebbieNigro.png'; else if ($d == 3 && $h >= 20 && $h < 22) $img = '/images/shows/DaveRamsey.png'; else if ($d == 3 && $h >= 22) $img = '/images/shows/JoyBrowne.png'; else if ($d == 4 && $h >= 0 && $h < 1) $img = '/images/shows/ShannonJoy.png'; else if ($d == 4 && $h >= 1 && $h < 2) $img = '/images/shows/BillNojay.png'; else if ($d == 4 && $h >= 2 && $h < 4) $img = '/images/shows/DennisPrager.png'; // THURSDAY SCHEDULE if ($d == 4 && $h >= 4 && $h < 5) $img = '/images/shows/DennisPrager.png'; else if ($d == 4 && $h >= 5 && $h < 10) $img = '/images/shows/RedEyeRadio.png'; else if ($d == 4 && $h >= 10 && $h < 13) $img = '/images/shows/BobRick.png'; else if ($d == 4 && $h >= 13 && $h < 16) $img = '/images/shows/DougStephan.png'; else if ($d == 4 && $h >= 16 && $h < 19) $img = '/images/shows/MariluHenner.png'; else if ($d == 4 && $h >= 19 && $h < 20) $img = '/images/shows/DebbieNigro.png'; else if ($d == 4 && $h >= 20 && $h < 22) $img = '/images/shows/DaveRamsey.png'; else if ($d == 4 && $h >= 22) $img = '/images/shows/JoyBrowne.png'; else if ($d == 5 && $h >= 0 && $h < 1) $img = '/images/shows/ShannonJoy.png'; else if ($d == 5 && $h >= 1 && $h < 2) $img = '/images/shows/BillNojay.png'; else if ($d == 5 && $h >= 2 && $h < 4) $img = '/images/shows/DennisPrager.png'; // FRIDAY SCHEDULE if ($d == 5 && $h >= 4 && $h < 5) $img = '/images/shows/DennisPrager.png'; else if ($d == 5 && $h >= 5 && $h < 10) $img = '/images/shows/RedEyeRadio.png'; else if ($d == 5 && $h >= 10 && $h < 13) $img = '/images/shows/BobRick.png'; else if ($d == 5 && $h >= 13 && $h < 16) $img = '/images/shows/DougStephan.png'; else if ($d == 5 && $h >= 16 && $h < 19) $img = '/images/shows/MariluHenner.png'; else if ($d == 5 && $h >= 19 && $h < 20) $img = '/images/shows/DebbieNigro.png'; else if ($d == 5 && $h >= 20 && $h < 22) $img = '/images/shows/DaveRamsey.png'; else if ($d == 5 && $h >= 22) $img = '/images/shows/JoyBrowne.png'; else if ($d == 6 && $h >= 0 && $h < 1) $img = '/images/shows/ShannonJoy.png'; else if ($d == 6 && $h >= 1 && $h < 2) $img = '/images/shows/BillNojay.png'; else if ($d == 6 && $h >= 2 && $h < 4) $img = '/images/shows/DennisPrager.png'; // SATURDAY SCHEDULE if ($d == 6 && $h >= 4 && $h < 5) $img = '/images/shows/DennisPrager.png'; else if ($d == 6 && $h >= 5 && $h < 10) $img = '/images/shows/RedEyeRadio.png'; else if ($d == 6 && $h >= 5 && $h < 10) $img = '/images/shows/RedEyeRadio.png'; else if ($d == 6 && $h >= 10 && $h < 12) $img = '/images/shows/HaidtReport.png'; else if ($d == 6 && $h >= 12 && $h < 13) $img = '/images/shows/ABCNews.png'; else if ($d == 6 && $h >= 13 && $h < 16) $img = '/images/shows/GarySullivan.png'; else if ($d == 6 && $h >= 16 && $h < 18) $img = '/images/shows/PopularTech.png'; else if ($d == 6 && $h >= 18 && $h < 19) $img = '/images/shows/WhatWorks.png'; else if ($d == 6 && $h >= 19 && $h < 21) $img = '/images/shows/JillMoney.png'; else if ($d == 6 && $h >= 21 && $h < 23) $img = '/images/shows/YouManual.png'; else if ($d == 6 && $h >= 23) $img = '/images/shows/MadeAmerica.png'; else if ($d == 0 && $h >= 0 && $h < 1) $img = '/images/shows/MensHealth.png'; else if ($d == 0 && $h >= 1 && $h < 2) $img = '/images/shows/AlanTaylor.png'; else if ($d == 0 && $h >= 2 && $h < 4) $img = '/images/shows/HughHewitt.png'; ?> <img src="<?php echo $img; ?>">Thank You! Kevin I'm using a time stamp where I'm getting the date and time from the database server rather than using a unix time stamp. Because I'm in a different time zone as the server, my time was always off by 1 hour. I fixed that problem by writing some code to adjust the hour of the time and the date depending on what time it was. It was working fine until a few weeks ago when I had to adjust my clock for daylight savings time... now the time is off by 2 hours because of that. Well, I fixed that and now it's working fine again. My question is does anyone know of a way to automatically determine whether or not I should be in daylight savings time or not so I can just use an if/else statement to keep the time adjusted properly rather than having to do it manually every time the time changes? Basically, I would like to do it something like the following: Code: [Select] <?php if ($daylightsavings = "y") { (adjust time/date for 1 hour difference); } else { (adjust time/date for 2 hour difference); } ?> Anyone have any ideas? Please help! User enters Date (that is somewhere in future, few hours or maybe few years). I need to store in MYSQL Date minus 6 hours keeping in mind daylight savings time. I tried to convert date to unix timestamp and subtract 6*60*60. Works great, but does not take into consideration daylight savings time. Code: [Select] <?php if(date('w') == 0) $str = 'today'; else $str = 'last sunday'; $timestamp = strtotime($str); //echo $timestamp; echo "<img src='brn_masthead.gif' width='500' /><br /><table border='1'><tr>"; echo "<tr><td align='center' width='140'><b>Sunday</b></td><td align='center' width='140'><b>Monday</b></td><td align='center' width='140'><b>Tuesday</b></td><td align='center' width='140'><b>Wednesday</b></td> <td align='center' width='140'><b>Thursday</b></td><td align='center' width='140'><b>Friday</b></td><td align='center' width='140'><b>Saturday</b></td></tr><tr>"; $j = 0; for($i = 0; $i < 14; $i++) { $thisdate = date('Y-m-d', $timestamp + ($i * (60 * 60 * 24))); ?> I've looked into mktime and checked the manual, but can't find anything that seems to work inside the loop. Thanks! PHP date and time function is not showing correct time on my local system I have the following php code date_default_timezone_set("Africa/Lagos"); $date = date('d-m-y h:i:s'); echo "Server Time ".$date ."<br>"; echo "The time is " . date("h:i:sa")."<br>"; $current_datetime = date("Y-m-d") . ' ' . date("H:i:s", STRTOTIME(date('h:i:sa'))); echo "Current time1: ".$current_datetime . "<br>";
Output
Server Time 21-05-21 09:55:39
Expected Output
Server Time 21-05-21 10:55:39
Any help would be appreciated. Edited May 21 by Ponel I tested each variable individually and it appears that the $format variable is causing problems everytime I plug it in. What am I doing wrong here? //$time is pulled from the db in the timestamp format //$tzone is a value like +1 hour, +3 hours etc. //$format is a value like M.d.Y h:i A function converttime($time){ return '<i>'.date($format, strtotime($time . $tzone)).'</i>'; } Hello. I'm trying to create a function that will turn my timestamp into something like "9 hours ago", "3 days ago", ect.. so far I have the below function which seems to do the job fine. only problem is when i try to include it within a span it always places itself right before it. I use Code: [Select] echo "<span class=\"smalltext\">".time_stamp($date)."</span>"; witht the following function Code: [Select] function time_stamp($session_time) { $time_difference = time() - $session_time ; $seconds = $time_difference ; $minutes = round($time_difference / 60 ); $hours = round($time_difference / 3600 ); $days = round($time_difference / 86400 ); $weeks = round($time_difference / 604800 ); $months = round($time_difference / 2419200 ); $years = round($time_difference / 29030400 ); // Seconds if($seconds <= 60) { echo "$seconds seconds ago"; } //Minutes else if($minutes <=60) { if($minutes==1) { echo "one minute ago"; } else { echo "$minutes minutes ago"; } } //Hours else if($hours <=24) { if($hours==1) { echo "one hour ago"; } else { echo "$hours hours ago"; } } //Days else if($days <= 7) { if($days==1) { echo "one day ago"; } else { echo "$days days ago"; } } //Weeks else if($weeks <= 4) { if($weeks==1) { echo "one week ago"; } else { echo "$weeks weeks ago"; } } //Months else if($months <=12) { if($months==1) { echo "one month ago"; } else { echo "$months months ago"; } } //Years else { if($years==1) { echo "one year ago"; } else { echo "$years years ago"; } } } in the end I get the span tag with nothing in it and the text right before it. What am I doing wrong? <?php function time_convert($l_timestamp) { $l_timestamp = $l_timestamp * 86400; $time = date('Y-m-d',$l_timestamp); echo(date('Y-m-d',$l_timestamp)); //This does return (date('Y-m-d',$l_timestamp)); //This does not work return $time; // This does not work echo $time; //This does not work } time_convert(32155.0); ?> Can anyone help me, I am not getting the return parameter as I want Hi there, what I have been trying to do is add some additional logic.. My problem is I want to stop displaying the month and day after the year 2000? I know I need to add an if and else statement but this is my first actual project and I am a little stuck.. here is the page, it's a plugin for a timeline http://www.llandover...oject-timeline/
And the file is attached below.. any help would be appreciated. The plugin code was too long to just post in here, didn't want to cause any slow loading issues for people on a slow connection.. Thanks and I appreciate any help.
Attached Files
annual_archive.php 18.15KB
5 downloads hello i got this small function i`m working on to get the date of a month something like get current date - 1 but not sure how to handle jan month can someone help me please ? $month = date('m') - 1; $date_startt = date('Y').'-'.$luna.'-01'; $timestamp_start = strtotime($data_start); Hello, I went to one of those paid sites to try and get help with a php project, the guy bid the job and worked for a few hours and then disappeared. Left me hanging and now I am turned off by trying to do that again so I have decided to try it myself.
So I have started over, and have gotten the front end of the website done, and having a few troubles with the admin end. So here is what I am doing...
Joomla 3.3
Ohanah Event Mgmt System
This system allows you to create events and add event photos, the system didnt allow descriptions to be added to those photos, which show on the front end and popup in a light box.
Here is a photo of the front end that is working now.
http://www.sbsracing...end-working.jpg
And here is the photo of the progress on the admin area, I have text fields added to each event photo once it is added. However I am having trouble coding the display and editing of the descriptions.
http://www.sbsracing.net/broken2.jpg
I believe this is only controlled by one file in the admin area. I have attached it to confirm this and will show the lines of code here that I think need to be changed.
First would be the add photo button area, which I havent figured out how to get the description there for, but would be ok adding descriptions after the photo was uploaded.
function createPicture() { if (eventPicture=="") { jQuery("#eventPicture").html('<table><tr><td><input id="selectPicture" type="button" class="button" value="<?=addslashes(@text('OHANAH_ADD_PICTURE'))?>"><label class="cabinet"><input type="file" class="file" name="pictureUpload" id="pictureUpload" /></label></td></tr></table>'); } else { jQuery('#picture').val(eventPicture); jQuery("#eventPicture").html('<table><tr><td><div class="photoOver section"><div class="photo"><div style="background:url(\'http://<?=$_SERVER['HTTP_HOST'].KRequest::root()?>/media/com_ohanah/attachments/'+eventPicture+'\') center center no-repeat; height: 240px"><img width="249" height="242" src="http://<?=$_SERVER['HTTP_HOST'].KRequest::root()?>/media/com_ohanah/v2/ohanah_images/blank.gif" class="picBorder" /><div class="buttonOverlay"><ul class="photoButtons"><li><a href="javascript:removePicture(\''+eventPicture+'\');" class="deletePhoto">Delete</a></li><li><a href="http://<?=$_SERVER['HTTP_HOST'].KRequest::root()?>/media/com_ohanah/attachments/'+eventPicture+'" target="_blank" class="zoomPhoto">Zoom</a></li></ul></div></div></div></div></td><td><input id="selectPicture" type="button" class="button" value="<?=@text('OHANAH_SELECT_NEW')?>"><label class="cabinet"><input type="file" class="file" name="pictureUpload" id="pictureUpload" /></label></td></tr></table>');And here is the code for the existing photos that are already uploaded.. which i have a text box showing for, but cant seem to get the desc to show or even better be able to edit and save it. function createPhotos() { jQuery( "#eventPhotos" ).html(''); var eventPhotos = '<table><tr>'; var i = 0; jQuery.each(photos, function(key, value) { eventPhotos +='<td>'; eventPhotos += '<div class="photoOver section" id="photo_container_'+i+'"><div class="photo"><div style="background:url(\'http://<?=$_SERVER['HTTP_HOST'].KRequest::root()?>/media/com_ohanah/attachments/'+value+'\') center center no-repeat"><img width="110" height="113" src="http://<?=$_SERVER['HTTP_HOST'].KRequest::root()?>/media/com_ohanah/v2/ohanah_images/blank.gif" class="picBorder2" /><div class="buttonOverlay"><ul class="photoButtons"><li><a href="javascript:removePhoto(\''+value+'\', '+i+');" class="deletePhoto">Delete</a></li><li><a href="http://<?=$_SERVER['HTTP_HOST'].KRequest::root()?>/media/com_ohanah/attachments/'+value+'" target="_blank" class="zoomPhoto">Zoom</a></li></ul></div></div></div></div><br/><input type="text" id="img_description_'+i+'" name="img_description" style="width:100px; margin-top:7px" placeholder="Description">'; if (((key+1)%3)==0) { eventPhotos +='</td></tr><tr>'; } else { eventPhotos +='</td>'; } i++; }); if(photos=="") { eventPhotos += ''; } // modifications var id = getParameterByName('id'); //alert(id); if(id!= '') eventPhotos +='<td><input type="button" class="button" value="<?=addslashes(@text('OHANAH_ADD_PHOTOS'));?>"><label class="cabinet"><input type="file" class="file" name="photoUpload" id="photoUpload" /></label></td>' else eventPhotos +='<td><input type="button" class="button" value="<?=addslashes(@text('OHANAH_ADD_PHOTOS'));?>"><label class="cabinet"><input type="file" class="file" name="photoUpload" id="photoUpload"/></label></td>' if(((photos.length)%3)==1) { eventPhotos +='<td><img width="104" height="106" src="http://<?=$_SERVER['HTTP_HOST'].KRequest::root()?>/media/com_ohanah/v2/ohanah_images/blank.gif" /></td>'; } eventPhotos +='</tr></table>'; jQuery( "#eventPhotos" ).append(eventPhotos); createPhotoToolbars(); }Maybe I am in over my head not sure yet, and maybe I will have to pay someone to finish this, but figured I would atleast give it a try first, I have the database edited to hold the values, which I have added manually. And they are displaying on the website correctly. Just having issues with the admin area. Help!! Thanks in advance. Attached Files images.php 8.15KB 1 downloads Write a function Counter() that keeps track of the number of times it is called. This function should not take any parameters and return the number of times that it has been called. I have a php code that call a process (a java program). The process runs in background for a so long time - from 1 minute to 2 hours. I make the process call using exec:
<?php function execInBackground($cmd) { if (substr(php_uname(), 0, 7) == "Windows"){ pclose(popen("start /B ". $cmd, "r")); } else { exec($cmd . " &> /dev/null &"); } } $command = "java ... ReadEmailsCmdLine 2>&1"; execInBackground($command); echo "FINALIZADO";Though the command runs in background it looks that the PHP code wait for the command completion to send a answer to client browser because I just see "FINALIZADO" after the java program finished its execution. Does someone know how I can solve this problem? Or at least does have a hint/pointer for that? Since now I thanks any comment/suggestion I’m translating some mixed PHP/MySQL code into pure MySQL code. Now I'm having a problem about how to translate PHP's time() function. I’m not sure how to choose between NOW(), CURDATE(), CURTIME(), and several others. I tried NOW(), but to my surprise it outputs today’s year (i.e. 2014) instead of the Unix integer timestamp I'm looking for. And this behaviour seems contray to the MySQL manual. What should I do ? I think it is unusual but i dont know to fix it. when my computer clock shows 16: 13 hours , date() reuturns 10:43:16 . My systems time zone is +5.30 GMT. how does date() subtracts 5.30 hrs from the system time? Hello, When I use this function, the time always refers to January 1st 1970 ?! How come? I get the output '4 decades 1 year 11 months' regardless of which date I enter into the function.. ? Code: [Select] function timeAgo($tm,$rcs = 2) { $cur_tm = time(); $dif = $cur_tm-$tm; $pds = array('second','minute','hour','day','week','month','year','decade'); $lngh = array(1,60,3600,86400,604800,2630880,31570560,315705600); for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]); $no = floor($no); if($no <> 1) $pds[$v] .='s'; $x=sprintf("%d %s ",$no,$pds[$v]); if(($rcs > 0)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= timeAgo($_tm, --$rcs); return $x; } When I call for the function I use this: Code: [Select] timeAgo($row['dateposted']) The format in the database for 'dateposted' is: Code: [Select] 2006-08-14 23:29:23 Any ideas what I am doing wrong? Thanks a million First, I would like to say when i tried to recover my account from this website, I took me 10 attempts to get the captcha right and then finally it said it sent me an email to my gmail account. I checked spam folder and everything there was no such email from this site. Then I decided to create a new account, well, it took me another 10 attempts to get the captcha right and finally when it was submitted, the page was loading for around 3 minutes before it signed me in.
My question is about the php date() function. It accepts a format to display a time. In the following example I use F for full representation of month, d for 2-digit day of month with leading zeros, Y for full year, g for 12-hour format without leading 0s, s for seconds and A for meridiem. It uses the correct format, but it gives me the wrong time. My local time is 4:43 and it prints out 4:12:
<?php echo "<p>order processed on " . date("F d, Y g:sA") . "</p>"; ?> Why is it 30 minutes behind? This is what I have for the form (in short version) along with the text area and submit button. The form shows up OK on the Internet http://www.lakegenevapieco.com/test_product_list.php The problem is when I fill it out & submit it doesn't do two things: 1) It doesn't E-Mail me the information 2) It doesn't say, Thank you for using our mail form. It actually says page not available. Here is the code: <html> <head> <meta http-equiv="Content-Language" content="en-us"> <title>Products to be listed on the web site for the month of</title> </head> <body> Products to be listed on the web site for the month of <select size="1" name="MONTH"> <option selected>PICK MONTH</option> <option>1-JANUARY</option> <option>2-FEBUARY</option> <option>3-MARCH</option> <option>4-APRIL</option> <option>5-MAY</option> <option>6-JUNE</option> <option>7-JULY</option> <option>8-AUGUST</option> <option>9-SEPTEMBER</option> <option>10-OCTOBER</option> <option>11-NOVEMBER</option> <option>12-DECEMBER</option> </select> <select size="1" name="YEAR"> <option selected>PICK YEAR</option> <option>2010</option> <option>2011</option> <option>2012</option> <option>2013</option> <option>2014</option> <option>2015</option> </select></p> <p><input type="checkbox" name="PumpkinSB" value="ON"> Pumpkin Price increase to <input type="text" name="PriceIncreaseTo151" size="20" value="$"></p> <p><input type="checkbox" name="PumpkinWalnutSB" value="ON"> Pumpkin Walnut Price increase to <input type="text" name="PriceIncreaseTo152" size="20" value="$"></p> <p><input type="checkbox" name="RaspberrySB" value="ON"> Raspberry Price increase to <input type="text" name="PriceIncreaseTo153" size="20" value="$"></p> <p> </p> <p> </p> <p> <?php function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } if (isset($_REQUEST['email'])) {//if "email" is filled out, proceed //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==FALSE) { echo "Invalid input"; } else {//send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("myemail@mia.net", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } } else {//if "email" is not filled out, display the form echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?> </p> </form> </body> </html> Hello, I was trying out some code to check out how some of the php settings work and when i tried allow_call_time_pass_reference to see if it works, it doesn't spew out any warning or error like the comments in the .ini file mention (or in the manual sites). Maybe i'm not using some other setting in order to see this? Here is my EXACT code. <?php ini_set('display_errors',1); error_reporting(-1); $variable = 'String'; function display($variable) { return $variable; } echo display(&$variable); ?> Outputs : String. No errors, no warnings. I'm running PHP Version 5.3.2-1ubuntu4.5 Basically I have recently been playing around with parsing a csv file. What I am looking to do at this point is simply take the date/timestamp (part of the csv file), which is in the following format:DD/MM HH:MM:SS.100th/s For the sake of argument, lets say I have this in an array string called $csv[0] and the file has several lines that span the course of a couple hours. I wouldn't mind having to use explode() to breakup/remove the date or 100th/s IF that would make things a lot simpler. So where would I start in trying to achieve this?. The result I am looking for will simply return "X Seconds". Storing this in a string variable would be a bonus, as I plan to use this to divide a separate piece of information. Any examples or ideas would be great. Thank you. ps: Here is an example time from the csv file itself: Code: [Select] 11/19 22:23:18.143 |