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 […]
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 […]
Because I was having a "duh" moment. $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]
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. […]
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 […]