php

How to update Select menu with AJAX w/out <div> inside form

Hey all, I am using an ajax call to update a select menu. The ajax call puts the list into my select menu by running from a different .php file. Here is the JS insertion snippet: if (req.status == 200) { document.getElementById('countydiv').innerHTML=req.responseText; } else { alert("There was a problem while using XM...

How to delete object from array inside foreach loop?

Hi, I iterate through an array of objects and want to delete one of the objects based on it's 'id' property, but my code doesn't work. foreach($array as $element) { foreach($element as $key => $value) { if($key == 'id' && $value == 'searched_value'){ //delete this particular object from the $array uns...

Help with an if and else statement logic

The code below is just a sample of the format I have isset($_GET['ids'])?$ids=$_GET['ids']:null; isset($_POST['idc'])?$idc=$_POST['idc']:null; function ShowCart() { $que = "SELECT FROM cart LEFT OUTER JOIN ... ON ... LEFT OUTER JOIN... ON... WHERE "; $result = mysql_query($que); while(){ i...

How do you run a command line program (like lame or svn) with PHP?

Specifically, I need to automate the encoding of audio files into mp3 with LAME. You don't need to know LAME to answer this, I could be talking about svn or some other program.. I know how to use LAME on the command line to do this, for one file at a time. I would like to do this via a php script however, so I can convert a bunch at o...

PHP - How to determine if request is coming from a specific file.

I have fileA.php on SERVER_A and fileB.php on SERVER_B fileB.php makes a curl request to fileA.php for it's contents How can fileA.php determine that the request is coming specifically from fileB.php? -- I was thinking about sending the $_SERVER['SCRIPT_NAME'] in fileB.php to fileA.php but since someone can go into fileB.php or any f...

Writing a video chat widget in Flash and PHP.

I am writing a webcam chat in flash (for the client side), I also am using PHP/Apache/Memcache for the server side for text chats... What exactly will I need in terms of server side software to connect these users flash/swf sessions together? I currently have an ubuntu server running Lamp (Apache/Php/MySql/Memcache)... the client to c...

Having a problem getting mysqli_query to execute.

Here's the problem: I started a swap today to use mysqli. No biggie, just had to change a few statements. Everything went fine, no errors... Except that I can't get it to execute any queries at all. I have double and triple checked my syntax. I even started creating situations where it SHOULD return an error (Trying to get it to INSERT t...

CodeIgniter Error - Undefined property: CI_Input::$post

I'm new to CodeIgniter and am trying to use the conditional below to determine whether or not the form has been submitted, and then display a certain view if it has. I got the error in the title for some reason and have been troubleshooting the problem for more than half and hour. Does anybody know how I might go about solving this probl...

Is there a way to avoid the "redeclared function" fatal error while defining functions within functions in PHP?

I've been implementing a certain plugin (dtabs) on my page in Wordpress but after upgrading to the latest version, I found that I now have an error the 2nd time I call the main function called dtab_list_tabs(). The way it works is, the plugin gets include_once'd but the main function is called however many times you want to place tabs i...

Removing Uploaded Files from Google when item Expires

We're using the Google CSE (Custom Search Engine) paid service to index content on our website. The site is built of mostly PHP pages that are assembled with include files, but there are some dynamic pages that pull info from a database into a single page template (new releases for example). The issue we have is I can set an expire date ...

Coloring a map depending on information (using google maps api or another api)

Hi, I am trying to build an application that will use an Api like google maps api (or any other api for maps) in order to color the states depending on some information that change. So for example, let's say I am going to color states green if they have more than 5 people online and this information will change every minute, how can i us...

innerHTML in IE?

I'm having trouble using innerHTML with my radio type button. <table align="center"> <div class='main'> <span id="js" class='info'> <label><input type="radio" name="js" value="0" size="<?php echo $row['size']; ?>" onclick="js(this.value, this.size);" /><img src="arrowup.png"/></label> <br /> <label><input type="radio" name=...

Automate converting excel xls file to excel xml

I have a web page where a user can upload xls files. When he uploads a file, i want to automate converting the excel file to excel xml. I want to convert it to an xml file as i think it will be easy to handle the data. Is it possible to write my own php function to do that? ...

how can i call from my website to mobile or landline phones. (in PHP,Flash, ..)

Hi all, I wish to call from mywebsite to mobile phone, how do i implement in PHP or Flash. Is it possible in PHP, flash, or any other technologies. ...

Function to create objects?

Is there a function I can use to instantiate an object with arguments? #include <database.h> class database { function __construct($dbhost, $user, $pass, $etc) { /* etc */ } function query($sql) { /* dowork*/ } } $args = array('localhost', 'user', 'pass', 'etc'); $db = create_object('database', $args); // is there a function li...

machine translation of HTML blocks

Is there any API (like google translation api) in PHP which allows to translate HTML blocks and translate only text out of the html ? ...

How can I control DOCUMENT_ROOT to work on localhost and live server?

To keep URLs working in version-controlled projects, I've been using $_SERVER['DOCUMENT_ROOT']. The problem is, I develop projects within a folder, so I get this: $_SERVER['DOCUMENT_ROOT'] . '/folder/path/to/file.php' When I go live, I generally simply want the following: $_SERVER['DOCUMENT_ROOT'] . '/path/to/file.php' I know there ...

Php search string (with wildcards)

Hi! Is there a way to put a wildcard in a string? The reason why I am asking is because currently I have a function to search for a substring between two substrings (i.e grab the contents between "my" and "has fleas" in the sentence "my dog has fleas", resulting in "dog"). function get_string_between($string, $start, $end){ $string...

User input filtering - do I need to filter HTML?

Hello all. Note: I take care of SQL injection and output escaping elsewhere - this question is about input filtering only, thanks. I'm in the middle of refactoring my user input filtering functions. Before passing the GET/POST parameter to a type-specific filter with filter_var() I do the following: check the parameter encoding with ...

How to put images on a 3 by 3 table?

Hi, I am using php/mysql, and have a database table with image url. I would like to know how can I put them on a php page with a 3 x 3 table, such that each td will show a different image based on the image url from the database? I want to create something like this, where the alphabets are the images: |a|b|c| |d|e|f| |g|h|i| So far...