php

Drawbacks to Overriding the isValid() function on Zend_Form

I have overriddend the isValid() function for a form, and I was wondering if there are any drawbacks to adding logic there. Example code: public function isValid($data) { // conditional requirement of fields $isValid = parent::isValid($data); if ($isValid) { // additional validation } return $isValid; } ...

Magento: select from database

hi there, I am working on my first module for magento version 1.3.2.3. I have created a simple table (not EAV, just a primary key and 2 columns) and some classes to access it, following Alan Storm's articles which helped me a lot, but I can't figure out how to make a simple select: Alan explains how to load with the primary key, but not ...

PHP + Mysql queries for a real Beginner

After years of false starts, I'm finally diving head first into learning to code PHP. After about 10 failed previous attempts to learn, it's getting exciting and finally going fairly well. The project I'm using to learn with is for work. I'm trying to import 100+ fixed width text files into a MySql database. So far so good I'm getting...

Testing against various PHP versions

I have a PHP app that I would like to test against various PHP versions. I don't need to configure it with Apache or mysql, a simple php command line binary would do. I would however need cURL with SSL support compiled in. The reason I ask as I tried compiling my own and ran into all sorts of issues with newer versions of curl don't w...

jQuery / PHP - sort html list by PHP array values?

I have a list like this: <li> <input value="1" name="bla[]" /> </li> <li> <input value="2" name="bla[]" /> </li> <li> <input value="3" name="bla[]" /> </li> (always the same order) and a array like this array('3', '1', '2'); but the order of the values in the array can change anytime. Can the list above be sorted with jQuery based...

Most efficient way to call Perl Libraries from within PHP?

Possible Duplicate: How can I use Perl libraries from PHP? I would like to make use of some libraries only available in Perl from my PHP applications. I haven't used Perl before but have been looking into it some and am still not sure of the best way to do this.. it seems a lot of the resources I found online were pretty old t...

CURL: not fetching url with unicode characters

I'm using CURL to fetch a Yahoo! BOSS api url with a unicode query, but I'm getting an "bad request" error. http://boss.yahooapis.com/ysearch/web/v1/கமல்ஹாசன்?appid={appid}&amp;format=xml The above url works fine and returns results in firefox. Please could anybody help me to fix this. $url = "http://boss.yahooapis.com/ysearch/web/...

In PHP: If I start a new line while writing a string in my source is it necessary to concatenate the string?

I'm learning PHP and MySQL together from Head First PHP & MySQL and in the book, they often split their long strings (over 80~ characters) and concatenate them, like this: $variable = "a very long string " . "that requires a new line " . "and apparently needs to be concatenated."; I have no issue with this, but what strikes me...

PHP - Sort array elements based on another array's elements :)

so I have two arrays. one of them looks like this (it's values or the number of elements can change): array('4dec' , 'def3', 'a3d6', 'd12f'); and the other: array(array('id' => 'd12f', 'name' => 'John'), array('id' => 'a5f1', 'name' => 'Kathy'), array('id' => 'def3', 'name' => 'Jane'), array('id' => 'a3d6', 'name' =...

How to add a public var in class in php?

Hello I currently have a error-system like this on my header.php: include('class.error.php'); Errsys::disable_default(); Errsys::enable_logging('errors.dat'); So, I'm not creating a new object via $asd = new Errsys;. How to add a variable to class, so it can be called like Errsys::variable or via any similar syntax inside or outside ...

Need some help with a HTML form PHP send email combo platter

PHP has never been my strong suit so I need some assistance getting the contents of a form to send via email properly in PHP. Here is the html form: <form action="estimate.php" method="post" > <fieldset> <input type="text" class="required" name="name" value="FULL NAME*" onfocus="if (this.value=='FULL NAM...

Firefox does not support JavaScript (form validation) but IE fully support.

Hi everyone! I developed a user input form in php used (php, html, javascript…). I wrote validate functions in JavaScript. The form is working fine in internet explorer and validate all the fields, but when I open in Firefox then, the form and fields not validate like (drop down menu field) not validate, but why? I am new in web developm...

Confirming action before processing!

Am doing a contact management site in codeigniter, i have a function which delete the contact based on id. For example the page will have all contacts listed. And each contact will have a link saying delete near it. The link will be to the function passing the id, like: www.site.com/index.php/action/delete/23 So i want a confirmation...

PHP Anonymous function with array_walk

Hello, I'm trying to use array_walk with an anonymous function, but I always get the error // Parse error: syntax error, unexpected T_FUNCTION in ... on line X if(!empty($myArray)) { array_walk($myArray, function(&$value, $key){ // Line X $value = '"'.$value.'"'; // Add quotes }); } The surrounding file syntax is corre...

PHP function to create 8 chars long hash ([a-z] = no numbers allowed)

I need PHP function that will create 8 chars long [a-z] hash from any input string. So e.g. when I'll submit "Stack Overflow" it will return e.g. "gdqreaxc" (8 chars [a-z] no numbers allowed) ...

Downloading multiple files from remote location with progress bar

I need to implement a feature where a user can paste one or more YouTube links, a PHP script then downloads all of them to the server, displays progress bar for each download and then inserts relevant information about them to database. How should I go about implementing this... Is this achievable with just file_get_contents()? Or perha...

How do I get the email address to show up in the body of the message?

I have a very simple form where users can enter their email and click submit to request a newsletter. PHP generates an email but it does not include the one important element: the subscriber's email! Here is the HTML: <form action="news.php" method="post"> <fieldset> <input type="text" id="your-email" value="YO...

Facebook and Twitter URL to post status

Is there a method that can post a status to Facebook or Twitter. Twitter has this: http://www.twitter.com/?status=This+is+the+status+that+will+be+grabbed+by+Twitter What about Facebook? Thanks. I know about doing it by cURL, but I'm not asking about that :p ...

Help with the calculation (and usefulness) of password entropy

This is a two part question: Part 1 First, dealing with calculating the entropy of a password in PHP. I have been unable to find any code examples that are empirically sound and would really like some help in finding the 'right' way to calculate a final number. A lot of folks on the net have their own home-baked weighting algorithm, ...

Can PHP manipulate (show/hide) div elements like jQuery?

I'm making a form and when a user hits submit, i want it to hide the form and show a section that says "thank you, blah blah" I'm using PHP/PEAR Mail Factory: $mailObj =& Mail::factory('mail'); $bool = $mailObj->send($recipient, $headers, $body); if($bool) echo "Thank you for your submission."; else echo "There was a problem ...