scriptygoddess

Archive for the ‘Script snippet’ Category

01 Apr, 2010

Showing multiple random quotes

Posted by: Jennifer In: PHP|Script snippet

Showing random quotes isn't anything new. When I needed to do something similar on a site recently, there were plenty of pre-written scripts to choose from. The trick however, was that I wanted to show more than one quote at a time (and of course I didn't want to show the same quote twice. That […]

09 Feb, 2007

Force File Download

Posted by: Jennifer In: Bookmarks|PHP Related|Script snippet|Scripts

How to force a file to download (without having to zip it up). $filename = "secure/writeToFile.doc"; header("Content-Length: " . filesize($filename)); header('Content-Type: application/msword'); header('Content-Disposition: attachment; filename=writeToFile.doc'); readfile($filename); a few other content types – lots more at the above link… "pdf": "application/pdf" "zip": "application/zip" "xls": "application/vnd.ms-excel" "ppt": "application/vnd.ms-powerpoint" "gif": "image/gif" "png": "image/png" "jpg": "image/jpg" "mp3": "audio/mpeg" "mp3": […]

This is one of those things I use all the time but because I can't remember things like this, I always have to look for the exact code to do it… This will take all the values submitted in a form and store them in a session: foreach($_POST as $k=>$v) { $_SESSION[$k]=$v; } And when […]

I needed to set the selection of a drop down menu. As far as I can tell, if you don't know the "index" value, then you just have to loop through to set the item as selected. If there's an easier way to do this, please speak up in the comments. I spent WAY too […]

29 Jan, 2007

Get current URL with PHP

Posted by: Jennifer In: Script snippet

Because I was having a "duh" moment. $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]

19 Oct, 2004

gifs that execute a php script

Posted by: Jennifer In: Lessons learned|Script snippet

Problem: (somewhat in line with my last post) I needed to run a script in the "background", but I only had the ability to present the script as a .gif. Solution: actually, I came up with two ways of doing this and both use .htaccess to pull it off. 1) I'm a gif but really […]

Needed to write a javascript that would take the values of one select box – and copy it to all the other select boxes on the same page. I found this script which will take all the values from one set of fields – and copy it to another set of fields (kind of like […]

Comments Off on Copy values from one field to another with javascript

I'm in the process of moving a few other blogs over to use WP – one of which makes calls to a seperate database unrelated to WP. This proved to cause a conflict. After many hours of trying to figure out where the specific conflict was – I narrowed it down to my mysql_select_db line. […]

10 Jun, 2004

Quick Tags for comments

Posted by: Jennifer In: Script snippet|WordPress

Since Alex released his js quick tags – it seemed like the perfect thing to add to the comments form so that people could put in the html tags more easily. However, while his script is really powerful – just for the comments form, it's more than what's needed. So I stripped it down to […]

02 Jun, 2004

Random with MySQL

Posted by: Jennifer In: Script snippet

Guest Authored by
Michelle – usr-bin-mom.com/


Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements