php

Unable to Style Div

Creating a blog from scratch is a difficult process but I've been plodding along with some minor issues which have been resolved. My minor issue today is the fact that I'm unable to style the site background with an image. I'm able to add colors but not an image. The second minor issue is to do with my Div tags. I've created a basic fo...

Filter content from mysql db with checkboxes using jQuery?

Hi all, I'm new to jquery and php and I'm having trouble doing this... I have a php webpage that gathers content from a mysql table. I want to be able to filter through this content with some checkboxes, but have no idea how to create the checkbox jquery code and for it to get the selected or checked results back from the database to d...

PHP string letters

We have a variable $string, its contains some text like: About 200 million CAPTCHAs are solved by humans around the world every day. How can we get 2-3 last or first letters of each word (which length is more than 3 letters)? Will check them for matched text with foreach(): if ('ey' is matched in the end of some word) { replace 'e...

Why should you validate forms using javascript?

What is the point in validating your HTML forms using Javascript, if you are always going to need to validate the forms using PHP anyway? I realize that you get a speed boost from this, and its more convenient to the user, but beyond that, is the time spent on it worth it? If anyone has any good evidence on this I would love to hear it. ...

PHP - check if a variable has been set with the name of the value of another variable.

I am setting up a template system, Long story short: I need/want to check if a variable with the name of a tag has been set. the tag name is in another variable. Therefore, I need to check to see if the content of $tag (i.e. title) has a variable with the same name ($title). Any help is appreciated. Thanks. ...

function query() on a non-object error

Hi, I am trying to create a plugin for Wordpress which allows the user to enter a title into a text box. The user then clicks 'submit' and that title is taken and added to the database. However currently when you press submit, it returns a PHP error: Fatal error: Call to a member function query() on a non-object in /home/matthew/publ...

How to install PHP in IIS 7.5, Windows Server 2008 R2 (64bits)

In http://windows.php.net/downloads I couldn't find any x64 built for download. Further I have to choose among "Thread Safe" and "Non Thread Safe" with no explanation whether one is safer than the other or it performs better. The install.txt inside the available ZIPs for download seems out-dated an it doesn't mention anything about this....

Nested mysql_query() - Resets first result's pointer?

I have a friend who's using FluxBB and he has just installed a modification for this forum software. The viewtopic.php file has a while-loop which does a mysql_fetch_assoc() on a result object. Inside of this loop there's a second mysql_fetch_assoc() on a second result object. The reason for the nested while loop is that there are many...

PHP preg_replace multiple rules

Hello my second family, :) I'm just wondering how to apply several rules for a preg_replace without executing them in the first run. Its a bit complicated let me explain based on an example. Input: $string = 'The quick brown fox jumps over the lazy freaky dog'; Rules: Replace a, i, o with u (if not at the beginning of a word & ...

jQuery to PHP and back again!

I'd like to pass content back and forth from PHP to jQuery and vice versa. I'm not sure if I fully understand the best way to go about this and am hoping for some best advice and clarification. Below is an example of something I'm trying to do. The PHP lists the files in a directory (whose path is passed to it from jQuery), stores them ...

Communicating between Mac OS X Preference Pane app and php5 web app

Wondering what the best method is for communicating between a 10.5/10.6+ System Preference Pane application to our php5 web application. The Preference Pane application that we've yet to develop will allow the client to authenticate to our online services, then allow them to control how their local client is backed up to our online back...

Is something wrong with wrapping whole Smarty templates in {strip} tags?

I want to keep my templates tidy and nicely intented but would like to deliver only very compact HTML to the browser. Missing a better idea, I was wondering if there is something wrong with wrapping whole Smarty templates in {strip} tags like so? {strip} <div class="albums"> <h2>Alle Foto-Alben</h2> <ul ...

email attachments to server

Hi there. I want someone to be able to email something (image, video, text) and then have that data be saved on my server in a special directory (the one representing the email address) and if possible take the text with the email and put the data into a database (tags, title, etc). What is the best way to do this? ...

PHP how to remove and add commas.

How can I remove extra commas and add commas for example using PHP user submitted data stack,,,,,,,,,,,,,,overflow should output. stack, overflow ...

Any PHP Framework with builtin A/B Testing Support?

Hi all, I'm about to start work on a new project and thought it could be a good time to also start looking into a new PHP framework. I've really only spent a lot of time with Joomla, so "new" can almost be "any". Anyway, I've also been seeing a lot of talk about A/B testing and thought that it might be a good idea to try. From what I'v...

How to search for largest value in array, and return associated key in PHP

I'd like to be able to return the number 15 in this case: Array ( [420315] => 1 [21714] => 1 [20] => 1 [1] => 1 [18] => 1 [241] => 2 [15] => 5 [1038401] => 1 [114] => 1 [293641] => 1 [387] => 1 [232] => 1 [11368] => 1 [9225] => 1 [100] => 1 [9254] => 1 [15326] => 1 [9246] => 1 [97] => 1 [9241] => 1 [14242] => 1 [9456] => 1 [366] => ...

php output with sleep()

I'm trying to run a loop every second for 25 seconds basically. for($i = 0; $i <= 25; $i += 1){ echo $i; sleep(1) } The thing is it doesn't output until it's fully done, so after the loop continues 25 times. Is there a way to do this so it will output before each sleep? and not wait until the full loop is complete? Thanks...

"Smart" text area auto indent

I'm attempting to make an auto-indenting textarea and so far it works with the following code. The problem that I'm having is that I'm currently preventing the default action of pressing enter in order to calculate the tabs in the line, and then inserting the newline afterwards. This works, but I want to have the default action of the t...

Aptana: Can PHP and HTML code assist happen in the same file?

I'm attempting to use Aptana for some web programming. For the most part, I'm impressed! One thing that's driving me crazy is that Aptana won't perform code assist on PHP code in an .html file... and conversely, won't perform HTML code assist in a .php file?! Am I missing something here? Pushing "best practices" aside for a moment... P...

HTML Agility to extract PHP tags.

What syntax should be used with HTML Agility Pack to extract all Tags from a Php file..? HtmlNodeCollection tags = htmlDoc.DocumentNode.SelectNodes("//??php"); Throws an exception (invalid token). Tried escaping ? with ?? and \? Thanks ...