php

PHP Objects and Closures

I've been asking a few questions on this topic recently, so I feel it appropriate to link up the associated question(s). http://stackoverflow.com/questions/4054424/php-closures-and-implicit-global-variable-scope I've got a set of classes that use closures as in the example below (keep in mind I quickly punched together this example for...

cakephp : how to get an array of elements from a web form

Hello In my cakephp form I have following code <p> <?php echo $form->input('option[]',array('size'=>13)); ?> </p> <p> <?php echo $form->input('option[]',array('size'=>13)); ?> </p> <p> <?php echo $form->input('option[]',array('size'=>13)); ?> </p> <p> <?php echo $form->input('option[]',array('size'=>13)); ?> </p> I am trying to get v...

Need an open source php based inventory / basic accounting system

Hi guys I'm looking for an open source inventory management system for a small store. Basically they require the following features: Product inventory management pricing of products supplier details customer details basic accounting services managing purchase orders managing sales reciepts etc print reports on a periodic basis Someth...

get <textarea> value using PHP Simple HTML DOM Parser

<textarea rows="1" cols="80" name="textarea{7}1" class="textarea_getcode">http://example.com/upload/logo.png&lt;/textarea&gt; Please tell me how to grab http://example.com/upload/logo.png Thanks .. ...

How to ignore "Trying to get property of non-object" error?

On my localhost, if I do echo $a->b where $a is not an object, it shows nothing. But on another server, it gives me an error of "Trying to get property of non-object". How to ignore this error? I just want a quick and easy way to make the code running, and I know what I am doing. ...

Multiple Calls To Function - Cannot redeclare class - php

I'm currently learning php, and I'm testing out oop and classes. My code is: <?php require('user.php'); $user = new User($username); $projects = $user->getProjects(); for ($n = 0; $n<count($projects); $n++) { echo "<li>"; echo "<a id=\"menu_pages\" href=\"\"><img src=\"../images/types/project.png\"/>" . $projects[$n]->name . ...

Turning photo into cartoon using PHP

Hi! Most probably using ImageMagick - how to turn photo into "cartoon"? Here's what I mean: (not sure, that step 2 is necessary). Thanks! ...

PHP: Problem with constant/pagetitle and facebook like-button

Hello everyone I'm using constants to display my page titles in different languages: // lang.en.php define(_PAGE_TITLE, "Pagetitle"); // lang.de.php define(_PAGE_TITLE, "Seitentitel"); I've placed a facebook like button on that page and everything works except for one thing: If I submit the link using the like button, the title ...

How many ways does PHP have to open a URL with POST data?

I'm writing a PHP error collection widget that collects errors from an application and then by making a POST request to a URL, reports them. How many different ways to do this are there, and how would you detect whether they are available? On different servers extensions may not be installed and security options may be turned off so I'd...

problem with compare two array with foreach

Hi, sorry for my english,but I have problem because I seek the same values of field and when I find the same value I print a message , if I don t find a same values I print an error message but this error message is repated and I want to print once if they are no same values this my code: foreach($row2 as $key => $value) { ...

extension question,YiiFramework

I use the module user http://yiiframework.com/extension/yii-user/ then open localhost/testdrive and get an error - trying to get property of non-object on line - array('url'=>Yii::app()->getModule('user')->loginUrl, did everything according to instructions from the link ...

subscription algorithm that scales

Web application PHP,Mysql. Users can write articles. How to build algorithm that allows users to subscribe (follow) to other users articles and then see list of last articles added by subscribed users? Algorithm must scale, so that one user can subscribe to 10 000 users and 10 000 users can subscribe to one user and all parts works quick...

AJAX (jQuery) Response

Suppose all forms in your application has this structure: <div id="result_messages"></div> <form action="/action"> <!-- all the form --> </form> A submit button for this form looks like this: <input type="button" onclick="$.post( '/action', $(form).serialize(), function (data) { $('#result_messages').html( data ); // At this ...

PHP Crawler for a asp.net site

I wanna write a crawler to fetch data. from an asp.net site which uses javascript to do the pagination ...

Generate class on list-item

I want php to print a class on each fourth list-item. Is that possible? <ul> <li>List-item 1</li> <li>List-item 1</li> <li>List-item</li> <li class="new_class">List-item</li> <li>List-item 1</li> <li>List-item 1</li> <li>List-item</li> <li class="new_class">List-item</li> </ul> ...

Cookies Not Working Properly

this is my code in logout.php <?php if(isset($_COOKIE['cookie-username']) || isset($_COOKIE['cookie-password'])) { setcookie("cookie-username", NULL, time()-60*60*24*100); setcookie("cookie-password", NULL, time()-60*60*24*100); } header( 'Location: ../login' ) ; ?> I can confirm the cookies exist, If I do a while...

Removing external styles from jQuery WYSIWYG editor in PHP

I have an issue with my WYSIWYG editor. If users copy in outside text, this is seen as something like the following: " p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Lucida Grande'; min-height: 13.0px} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px 'Lucida Grande'} Only the variables assigned in the last loop are a...

Load multiple variables from PHP via jQuery AJAX request

OK, i have this jQuery script using ajax to load a response from a php file, but i want to do is to load maybe two variables from the php script rather than the whole page. $(document).ready(function() { $.ajaxSetup({ cache: false }); $("#object_area").load("test.php"); var refreshId = setInterval(function() { $("#object_...

Allowing PHP $_POST with htaccess

Hi all. I'm not so good on htaccess but was happy with what I had done so far until I noticed my $_post variables were not being processed because of the rewrite signiture within my htaccess file (SIGH) My objective was to read the url and determine it's path and location from php and it's $_SERVER['request_uri'] method, which works fin...

DOMDocument::validate() problem

Hello I have a big problem with the PHP DOMDocument::validate() who seems to ask the DTD systematically. It is a big problem when I whant to validate, for example, an XHTML document as explained here. As w3.org seems to reject all request from a PHP server, it's impossible to validate my document with this method... Is there any solu...