
jakebur01
Members-
Posts
885 -
Joined
-
Last visited
Everything posted by jakebur01
-
That's exactly what I was looking for!! Thank you. That is awesome. @Barand Yes, for users to download. It's a lot cleaner to me than a php file name. And I'm using a variable as the filename.
-
I don't know how to do exactly yet, but this is what I have in mind. Is this the right direction? $today = date("Y-m-d"); $originalstart = date("Y-m-d",strtotime('-24 months', strtotime($originalstart))); for( $i= 1 ; $i <= 24 ; $i++ ) { $start = date('Y-m-d',strtotime('+'."$i".' month', strtotime($originalstart))); //need to make day 01 somehow $firstday = new DateTime($start); $firstday->modify('first day of this month'); if(sunday){ //use sunday } elseif(tuesday thru thursday){ //use this past sunday } elseif(friday or saturday){ //use next Sunday } $lastday = new DateTime($start); $lastday->modify('+1 month'); $lastday->modify('last friday'); $lastday->modify('+1 day'); }
-
I need to find the last Friday of each month and determine the start and end dates of each month based on the last Friday. So, for September, the last Friday was the 27th, that means Saturday the 28th will be the last day of September. September 29 will then start the first day of October.... October 25 is the last Friday in October, so Saturday October 26 will close out October..... Sun Oct 27 starts November, etc... 7/28 - 8/31 9/1 - 9/28 9/29 - 10/26 10/27 - 11/30 I can build a table and manually key in the start and end dates then query as needed, but if there is a way to do it on the fly, I'd rather do it in php to eliminate mistakes. Below is the code I'm currently using to find the first and last day of each calendar month, but I'll need to convert this to find the fiscal month based on the last Saturday of each month. And go back a few years in the option select. <select name="dateselect" id="dateselect"> <?php $today = date("Y-m-d"); $monthbegin = date("Y-m-d",strtotime('first day of this month', strtotime($today))); for( $i= 0 ; $i <= 52 ; $i++ ) { if($i == 0){ $monthselect = date('Y-m-d',strtotime($monthbegin)); $monthdisplay = date('F Y',strtotime($monthbegin)); echo '<option ' . ($i == 0 ? 'selected=\'selected\'' : '') . ' value="' . $monthselect . '" >' . $monthdisplay . '</option>'; } else{ $monthselect = date('Y-m-d',strtotime('-'."$i".' months',strtotime($monthbegin))); $monthdisplay = date('F Y',strtotime('-'."$i".' months',strtotime($monthbegin))); echo '<option ' . ($i == 0 ? 'selected=\'selected\'' : '') . ' value="' . $monthselect . '" >' . $monthdisplay . '</option>'; } } ?> </select> $begin_date = $_GET["dateselect"]; $end_date = date("Y-m-t", strtotime($begin_date));
-
Is it possible to feed the browser a default save as name for the image when outputting to the browser, instead of it defaulting to the .php file name? So, instead of myimage.php I could use imagename.jpg or whatever I want.
-
I was able to get the javascript working. $(document).ready(function(){ /* PREPARE THE SCRIPT */ $("#dateselect").bind('load change', function(){ /* WHEN YOU CHANGE AND SELECT FROM THE SELECT FIELD */ var my_js_date = $(this).val(); /* GET THE VALUE OF THE SELECTED DATA */ var dataString = "my_js_date="+my_js_date; /* STORE THAT TO A DATA STRING */ var imgurl = "myimage.php?date=" + my_js_date; $().ready( function() { $("#myimg").attr("src",imgurl); }) }).triggerHandler('change'); });
-
I'm complicating things now. I have an option select to select the date. The image displays on the initial value. But, the image is not changing when I change the selection. <select name="dateselect" id="dateselect" oninput="document.getElementById('my_js_date').innerHTML = this.value"> function bodyOnLoad(){ var e = document.getElementById("dateselect"); document.getElementById('my_js_date').innerHTML = e.options[e.selectedIndex].value; }
-
Do you know how to insert a javascript variable into the path? Javascript variable eventdate <img src='myimage.php?date=JAVASCRIPT eventdate VARIABLE HERE'> I've used javascript variables with php before but it's been several years.
-
Wow. I'm using session_start() on my image page and querying data where user_id = session user id. That's pretty cool that the session still works through an image link and the user doesn't have to be directly on the page.
-
That's what I was thinking! Thanks.
-
I'm calling the image page via ajax. Depending on what date is selected will be written to the image. However I'm getting header error on my main page. What would be the proper way to display the generated image to the user? Can I do it without saving it? // FETCH IMAGE & WRITE TEXT $img = imagecreatefromjpeg('balloon.jpg'); $white = imagecolorallocate($img, 255, 255, 255); $txt = "Hello World"; $font = "C:\Windows\Fonts\arial.ttf"; imagettftext($img, 24, 0, 5, 24, $white, $font, $txt); // OUTPUT IMAGE header('Content-type: image/jpeg'); imagejpeg($img); imagedestroy($jpg_image); // OR SAVE TO A FILE // THE LAST PARAMETER IS THE QUALITY FROM 0 to 100 // imagejpeg($img, "test.jpg", 100);
-
Trouble Posting Option Select to IPN Listener
jakebur01 replied to jakebur01's topic in PHP Coding Help
I also tried: // compose message printArray($_POST); function printArray($array){ foreach ($array as $key => $value){ $message .= "$key => $value<br />"; if(is_array($value)){ //If $value is an array, print it as well! printArray($value); } } } $message = wordwrap($message, 70); // send email mail($to, $subject, $message, $headers); But, it was blank. I know it is posting the custom field for sure as I have sent different values and received them back via post. -
Trouble Posting Option Select to IPN Listener
jakebur01 replied to jakebur01's topic in PHP Coding Help
Since I am not the one accessing the page, but Paypal, I've been trying to troubleshoot via mail(). I tried putting var_dump into my message but didn't work. $message = "<pre>"; $message .= var_dump($_POST); $message .= "</pre>"; $message = wordwrap($message, 70); // send email mail($to, $subject, $message, $headers); Ok... I used: // compose message $message = "<pre>"; $message .= print_r($_POST); $message .= "</pre>"; $message = wordwrap($message, 70); // send email mail($to, $subject, $message, $headers); But, all it returned was the number 1. "1". -
This is more of a Paypal question, but I'm using php on the listener and hopefully someone has run into this problem. I'm having trouble finding the correct POST name to use to get the OPTION SELECT for the item on my listener page. I tried: $option = $_POST['os0']; But, I'm not getting anything using that. I've also tried os0_x, on0, and on0_x. This is what I'm posting to Paypal: <input type="hidden" name="on0" value="Term"> <select name="os0"> <option value="1 Year">1 Year</option> <option value="3 Years">3 Years</option> <option value="5 Years">5 Years</option> </select>