php

having problem with this ajax module !

i am having problem with this javascript, its reloading the page and not submitting the form. ! var xmlHttp function GetXmlHttpObject(){ var objXMLHttp=null; if (window.XMLHttpRequest){ objXMLHttp=new XMLHttpRequest(); }else if (window.ActiveXObject){ objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); } return objXML...

Explode and get a value in one line of code

Can you write the following in one line of code? $foo = explode(":", $foo); $foo = $foo[0]; ...

Ruby equivalent to PHP's "unserialize" function?

I'm working with some serialized data from a MySQL database and I need to deserialize this using Ruby (the serialized data is used to build up a WHERE clause for a database query). PHP has the unserialize() method which will convert it into an Array; what is the Ruby equivalent of this? The data in question looks like this, if it helps...

Add new data into PHP JSON string

Hello. I have $data as JSON encoded data and I have this string: $new_data = "color:'red'"; that needs to be added to $data so that I can read it from it as a json string. How can I achieve this ? Thank you. ...

OOP Registration System

Hi. I am working on a registration system. To sign-up for an account, a user must fill out a form. They can register as either an individual or a company. Also, users can choose a registration type such as Pro or Basic. A company registration includes the individual registration as well, but as a company, you can get a deal so that you...

Can the PHP value mbstring.internal_encoding be set from a htaccess file?

The following PHP command used to enable function overloading for multibyte data doesn't seem to work when set from inside a .htaccess file: php_value mbstring.func_overload 7 I read there was a bug in PHP 5.2.x versions that prevented this from working properly, however I'm using PHP 5.3.0 and it still doesn't work? But if this sett...

PHP http handling

Is there a way to prevent a php script from sending a http response when the script is finished executing? If not in php is it possible in any-other common web scripting langues? ...

PHP json_encode and javascript functions

I need to encode a javascript function into a JSON object in PHP. This: $function = "function(){}"; $message = "Hello"; $json = array( 'message' => $message, 'func' => $function ); echo json_encode($json); outputs: {"message":"Hello","func":"function(){}"} What I want is: {"message":"Hello","func":function(){}} ...

Checking querystring values in PHP

http://localhost/?area=characters&amp;name=Michal+Stroganof $result = mysql_query("SELECT * from players WHERE name = '$_GET[name]'"); while ($row = mysql_fetch_assoc($result)) { echo "Name: " .$row['name']. "<br>"; echo "Level: " .$row['level']. "<br>"; } This is all code of my characters.php If the get variable "name" ...

jQuery populate items into a Select using jQuery ajax json, php

I have a select field. I must fill with options taken from a mysql table. Here is some little php code I have done using codeigniter framework $idcateg = trim($this->input->post('idcategory')); $array1 = array( 'result' => $idcateg ); echo json_encode($array1); Now, the jQuery call... $.post("<?=base_url()?>index.php/rubro/list_a...

Issues with a drupal form submission with a checkbox whose value is 0

I am writing a drupal module that involves a form with many checkboxes. E.g. $form['myform_checkboxes'] = array('#type' => 'checkboxes', ...) I have made the key for these checkboxes numeric, starting with 0. E.g. $form['myform_checkboxes']['#options'][0] = '0:00'; $form['myform_checkboxes']['#options'][1] = '1:00'; Upon implementi...

php session id and ajax, javascript

It has come to my attention that my website is not working correctly under many versions of Internet Explorer. After looking around everywhere, I did a "cookie" test (http://www.rgagnon.com/jsdetails/js-0092.html), and realized that cookies are not working when I use any version of IE, but works fine with Chrome, Firefox, Safari ... It ...

Regex for timestamps in php

I'm trying to take timestamps in this format: 2009-11-16T14:05:22-08:00 and make turn them into something like 2009-11-16 How do I remove everything after the "T"? ...

Cakephp: How would I route all missing controller/action calls to a single, general error page?

I've got a cakephp app that I'm trying to get to serve up the Pages::404 function (and corresponding view) whenever Cake encounters any error (missing controller, action, etc). What's the best way to do that? ...

php session.use_trans_sid

I am not clear on the meaning and usage of php's session.use_trans_id . On the online documentation, it says: the run-time option session.use_trans_sid are enabled, relative URIs will be changed to contain the session id automatically. Does this mean it will ALWAYS add the session id? Or only when cookies are not working? ...

How does Doctrine handle changes to the database schema?

In brief, what happens when you add a column to a table? What happens when you remove one? In more details, suppose you have the following: class User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('username', 'string', 255); $this->hasColumn('password', 'string', 255); } }...

How to IPC between PHP clients and a C Daemon Server?

Hi all, and thanks for taking a look at the question. The background I have several machines that continuously spawn multiple (up to 300) PHP console scripts in a very short time frame. These scripts run quickly (less than a second) and then exit. All of these scripts need read only access to a large trie structure which would be very e...

How do i create an email this page form for my website?

I was looking on how to create a recommend this page form that sends the given pages URL address and where the user can enter their email address and a message however long and a single email address or multiple addresses where the user wants to send the recommend this page to. I was wondering if anyone knew what code I could use. I am ...

Get image color

I want to display images inside divs or tables as backgrounds. If they images aren't large enough, I'm going to need to find the outer most color of that image and apply it to the background of the containing div or table cell. Does anyone have experience with this? In PHP. I'm a noob so please explain. Thank you so much ...

working with XML in PHP

I have a string exactly like that: <info> <m_album>value1</m_album> <m_cat>value2</m_cat> <cat_type/> <cat_permission>0</cat_permission> <m_img_thumb><!--[CDATA[urlvaluetoimage]]--></m_img_thumb> <m_img_medium><!--[CDATA[urlvaluetoimage]]--></m_img_medium> <m_img_large><!--[CDATA[urlvaluetoimage]]--></m_img...