Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. What you're trying to do is difficult for a reason. The best bet is to limit it to a certain number of characters, and if it's a few less than what fills the space, it's not the end of the world.
  2. Can you explain how to do that after the content headers I specified are shown? The popup contains the PHP page which generates the file, and sends it to the browser using those headers. How then do I print javascript to the browser? Or do you mean using the original page? I can see that working but I wonder if it will block the download dialog. IE6 is mandatory.
  3. The file is generated by a PHP script, it is not a static file.
  4. I have a page which is served via ajax. Depending on the user's selections, the page might present an excel or pdf file to download and save. So far the best way I've found to do it is have the ajax page load some JS to open a popup and that page presents the appropriate headers, since the page being loaded into a <div> on the existing page can't send the file correctly. header('Content-Type: application/vnd.ms-excel'); header('Content-Disposition: attachment; filename="file.xls"); header('Cache-Control: max-age=0'); So how can I get the popup to close automatically? It does in Firefox but the company uses IE6. I can't send HTML or JS to the popup since the headers specify it's an excel file - is there any way to close it? Or any tips on a better way to do this?
  5. The error message just says "Must contain at least one letter and one number" - I think that's clear enough... I might change it later tho if I find it's confusing, thanks :)
  6. Right, I know how to check for a letter OR a number, but I want both. (password strenth!)
  7. Sorry, what it wasn't matching was: 1test. This is the new expression that matches 1test and test1 and test1test so I think it will work. Can it be simplified any? /([a-zA-Z])+([0-9])+|([0-9])+([a-zA-Z])+/
  8. I want to check that a string contains a letter and a number. I figured the simplest way for ME to do it is check it contains one letter, and then check if it contains a number, and if both are true, it's good. I just still don't get regex. <? print preg_match('/[a-zA-Z]+[0-9]+/', $value); ?> What am I doing wrong? I put "test1" as $value and still get 0?
  9. Javascript. It sounds like what you want to do is client side, not server side.
  10. Thanks for posting the code, but please tell us exactly where you are stuck, not just your goal. Not many people will want to read all the code and try to debug it without knowing why you are stuck. What is the problem you have now?
  11. Take the time part out of your $fmt. Also obviously $rightnow isn't being set. Try printing it before using date(). Wednesday, December 31, 1969 is the epoch.
  12. Then set up a cron job to check every 12 hours, and store the data. The point is to check their site as infrequently as possible.
  13. Correct. So you know as long as it returns a number 0 or more, it was found. So if it finds it, you can add that state to your list of ones found.
  14. Rather than using explode, try strpos() for each state. If the strpos is not false, you know the state is in there. There may be a way to do it with an array but this is the first way that comes to my mind.
  15. What those sites probably did is get the data once, then store it in their own database to display on their site, that's why they're faster. Neopets FTW!
  16. try using the functions strtotime() and date()
  17. Not sure where you're going with that, but alright. Good luck OP.
  18. How do you store an array in a database? He's said database like 5 times, so yes, storing data was mentioned...
  19. Please post code in code tags, it makes it easier to read. You have an array of images called $img, but I don't see you using sort() anywhere.
  20. I would recommend instead of including a file in another file, put the code to do this in a function, and pass it a parameter of what file to read. Rather than include, you'll call my_replace('file.php');
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.