php

How to generate an Excel document with multiple worksheets from PHP?

I want to generate an MS Excel file from PHP. I know one can do something like this: header ( "Content-type: application/vnd.ms-excel" ); header ( "Content-Disposition: attachment; filename=foo_bar.xls" ); But it will generate a file with just one Sheet. What I want is generating a file with multiple sheets. How can I do that? Maybe t...

Allow users to select an arbitrary element on the page

I'm coding a templating system that is supposed to support easily converting any old html/xhtml form into a format that can be used with my system (it's a template system for my cms). Here's what I'm aiming for: The user clicks a "Zone Define" button for example: "Content", "Sidebar", etc When the user hovers any elements they become ...

In symfony forms how I can validate a field (i.e. password) querying the db for the right value ?

Newbie question. I've created a very simple LoginForm class in symfony. It checks if the user inserts the username and the password in the field and It work as expected. // UserLoginForm :: configure() $this->setWidgets(array( 'username' => new sfWidgetFormInputText(), 'password' => new sfWidgetFormInputPassword(), )); $this->setV...

A count for loop!

I have tried everything to get this to work and just cant get the count right. <?php $total = count($u); for ($i = 0; $i < $total; $i++) { $j = 0; $s = $database->checkUserPlayedRecent($u[$i]); ...

CakePHP not setting the $this->Model->id variable

I am currently trying to access the data that was just inserted using: if($this->User->save($this->data)) { $user_id = $this->User->id; #119 ... But I get the error: Notice (8): Undefined index: id [APP/controllers/users_controller.php, line 119] Code | Context if($this->User->save($this->data)) { $user_id = $this->da...

Upgrading Wampserver

Hi, I looked for a specific answer to this question, but couldn't find it -- even on the WAMPSERVER site. I'm sure I overlooked it. I have Wampserver 2.0, with MySQL 5.0.51b, PHP 5.2.6, and Apache 2.2.8. Would it be correct to install Wampserver 2.0i (MySQL 5.1.36, PHP 5.3, and Apache 2.2.11) over the older installation? Would I los...

hide header post data

I have never used Api's before. I am trying to sms enable my website. My sms provider provides a HTTP API to send messages from my website. It works well. However, its not secure. The api requires number, message, Username and password. And can be sent using post or get. There is no https support. I am currently passing the number and me...

Install cURL in CentOS

Can someone direct me on how to install cURL on a CentOS server. Preferably through WHM if it's possible to recompile PHP that way.. I am a noob in SSH and this is a production server. ...

How do I set the first entry of a combo box to empty? PHP/MySQL

My code is retrieving player names from a database and outputting them into a combo box. However I want the first entry of the combo box to be empty, how can I achieve this? If it helps, here is my code. Please note I only have 1 option box code in HTML as I'm editing phpBB. The <-- BEGIN clubplayer --> is a loop. ...

Problem with Gallery Uploading

I've got an image uploader that doesn't upload images. I'm not receiving any errors and i've checked the folder permissions and even on 777 no images are getting uploaded. You can see the code here: http://pastebin.com/gvH1dKh9 The value for gallery_path is /home/domain/public_html/assets/images/gallery The value for gallery_path_url...

function call 'clear_all_cache' and 'clear_assign' is unknown or deprecated. error in smarty?

I need to remove the cache when a user change language, but I get an error message. $smarty = new Smarty; //$smarty->force_compile = true; $smarty->debugging = true; $smarty->caching = false; $smarty->cache_lifetime = 120; if (isset($_COOKIE['country'])) { $country = $_COOKIE['country']; $language = "eng"; if ($country ...

PHP web development

I want to write an app for facebook. Googling suggest me that the best language and technology will PHP. But the thing is I have never develop anything on PHP. My Question is which PHP version I should. Which IDE, where to start web development and where to start facebook API ...

php amazon xml order processing

I'm trying to automate my Amazon order processing. Currently I'm using Amazon Merchant Transport to get the XML file for an order, but eventually, I'll want to get the xml files with a web-service directly to my seller central account. Partial array with Amazon order info - Array ( ... [37] => Array ( [tag...

Installing PHP APC on Windows/Apache

i need help installing and configuring PHP APC i have downloaded from http://downloads.php.net/pierre/ in my PHP info, i see Compiler MSVC9 (Visual C++ 2008) Architecture x86 so i downloaded php_apc-5.3-nts-svn20100226-vc9-x86.zip. then to install, i tried adding [PHP_APC] extension=php_apc.dll to php.ini. restarting Apach...

How do I do Session Management with RackSpace Cloud?

If I am running more than two instances of a server (using rackspace-cloud's ip groups), how do I manage my sessions with PHP? Is there a way to make users 'sticky' to the server they logged into originally? I do use memcached, but all of the cloud systems have memcached on them, I need to insure a users session gets to the right ser...

PHP/Smarty - How to check an array for objects with specific values, and create temp array of those objects

First-timer here, I hope I explain this well enough... PHP/Smarty, I'm working on a section of a page that displays bullet lists of notes associated with either the general page, or individual places on that page. Some places don't have notes. Something like: General note 1 New York note 2 note 3 Boston note 4 I have two a...

Smarty template question

hi, i am new to smarty template and i am trying to do this. I have a html form in the tpl file and in that form action is for a php email function email.php. I am not able to get it to work. if i have the complete code(html form + php email code) and save as a php file, it works fine. is there any way to call the php code from email.p...

Is my PEAR package installation okay?

I want to install PEAR's Mail package. I went through the Terminal and installed Mail and its dependencies. The files were saved to my /usr/lib/php directory. In that lib directory I also have a 'PEAR' directory but my new packages weren't saved there. Do I need to drop the new packages into the PEAR directory or is it okay to let them s...

preg_match_all: Why would "this" match but "that" won't?

So, I'm basically trying to match anything inside (and including) object tags, with this: <?php preg_match_all('/<object(.*)<\/object>/', $blah, $blahBlah); ?> It finds a match for this: <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="250" codebase="http://download.macromedia.com/pub/shockwave/cabs/fl...

HTML Helper - Reusable View - PHP

Hello.. I am new to PHP and I was hoping someone could help me determine what the best way to go about creating a reusable view would be. What I have is a form that will be used to Add or Edit data. Therefore the view will be identical except in the case of an Edit the form fields will be populated. So I am creating an HTML helper that...