I am completely new to javascript/jquery, and would appreciate any help. I am having trouble with the function $.post because I am using radio in the form. I need to use the value of the chosen radio in a different file, so that I can process what should be outputted, and then I want to output something in pl…
Check if multiple values are all false or all true
How can I check if 20 variables are all true, or if 20 variables are all false? if possible without using a really long if … the variables are actually array elements: array(‘a’=> true, ‘b’=> true …) to make it more clear: if the array has both true and false values r…
How to get complete current url for Cakephp
How do you echo out current URL in Cake’s view? Answer You can do either From a view file: Which will give you the absolute url from the hostname i.e. /controller/action/params Or which should give you the full url with the hostname.
Pass a variable to a PHP script running from the command line
I have a PHP file that is needed to be run from the command line (via crontab). I need to pass type=daily to the file, but I don’t know how. I tried: but this error was returned: Could not open input file: myfile.php?type=daily What can I do? Answer The ?type=daily argument (ending up in the $_GET array…
Replace spaces around hyphens with nbsp
I’m in need of (probably) regexp (or two) to do following: replace every space after any single letter word with I found this question, however, if there’s word with apostrophe (like there’s), previous regexp ‘thinks’ that the ‘s’ after the apostrophe is si…
How to run array_filter recursively in a PHP array?
Given the following array $mm When I run count(array_filter($mm)) I get 3 as result since it is not recursive. count(array_filter($mm), COUNT_RECURSIVE) also will not do because I actually need to run the array_filter recursively, and then count its result. So my question is: how do I recursively run array_fi…
Help converting vBulletin 3.6.4 to phpBB 3
So I’ve been researching, and it looks like converters only exist from vBulletin 3.x to phpBB 2.0 and then from phpBB 2.0 to 3.0 I would rather not do a two-step conversion, but I don’t want to do a …
Search Array : array_filter vs loop
I am really new in PHP and need a suggestion about array search. If I want to search for an element inside a multidimensional array, I can either use array_filter or I can loop through the array and see if an element matching my criteria is present. I see both suggestion at many places. Which is faster? Below…
Where should I store an encryption key for php?
I’m writing a php application that accepts sensitive customer data, and so I need to encrypt it before storing it in a mysql database. I’m going to use mysql’s built-in AES functionality to do column-level encryption. I want to avoid storing the encryption key on the server, and so i’m…
How to stop jQuery .ajax() execution when success is false?
I have this code which works. $.ajax({ type: “GET”, url: “includes/process.php”, data: “captcha=” + captcha, success: function(data) { if(data == ‘true’) …