How should an Ajax endpoint respond to a non-ajax request?

I am in the process of writing the backend to respond to ajax queries. I am using Codeigniter, and my controller is made up of a bunch of these functions.
public function name_change()
{
if($this->input->is_ajax_request())
{
//Grab the Inputs
[...]

How can I know which option is selected in an HTML form?

I want to have a multi-step form with HTML and PHP.
The first step of my form is an option like:
<input type=”radio” name=”service_type” value=”plan1″> Plan 1<br />
<input type=”radio” name=”service_type” value=”plan2″> Plan 2

Now, my question is: how can I know which option is selected so that I arrange the next step options for the user?
For example: If [...]

PHP Eclipse live file editing or FTP

I am assigned on a project where I need to code an entire website. But I want to work on realtime environment. My favourite IDE is PHP Eclipse and I want to know is their any plugin for it where I edit any files and the changes will be uploaded directly on the live server?
I [...]

showing a list from the past 24 hours

I have a list which shows all the orders that have been placed with the company, from the beginning. the php script for this is shown below:
<?php
if (isset($HTTP_GET_VARS['cID'])) {
$cID = tep_db_prepare_input($HTTP_GET_VARS['cID']);
$orders_query_raw = “select o.orders_id, o.customers_id, o.customers_name, o.customers_id, o.payment_method, o.date_purchased, [...]

timestamp on mysql query

i have a search engine, which grabs links and titles from a mysql database and loops them into a page which matches what the user inputs. it is a query essentially and i would like to know how i could create a stamp which calculates a) how many rows are being returned and b) how [...]

Debugging in Firebug

Wonder if anyone can give some advice.
Bascially this is something I come across from time to time – I’m learning to debug using firebug and trying to track down where a style attribute is being set in a complex bunch of wordpress/fancy box files.
Bascially I’m trying to get fancybox to autosize to width of element, [...]

htmlentities ‘Invalid Multibyte Sequence’ error

While trying to run a string through PHP’s htmlentities function, I have some cases where I get a ‘Invalid Multibyte Sequence’ error. Is there a way to clean the string prior to calling the function to prevent this error from occuring?

Substitute ereg_replace for preg_replace, remove repeated dashes

Well, as you know, ereg_replace has been deprecated as of PHP 5.3.0. I use it to remove repeated dashes from a text. For example: this–text—-with-dashes would end up in this-text-with-dashes.
The code is:
$text = ereg_replace(“\-{2,}”, “-”, $text);

As I’m really bad at regular expressions, how could I do the same thing with preg_replace? Please note that only [...]

Doctrine2 trying to insert DateTime("now") into mysql datetime column

I am trying to insert date time in mysql datetime column by using following code but it is not being inserted. while isDelete working fine.
/*
*
* @ORM\Column (type=”datetime”)
*/
protected $created;

/**
* @ORM\PrePersist
*/
public function prePersist(){
$this->created = new \DateTime(“now”);
$this->isDelete [...]

Server Side PHP Long polling

I’ve asked many questions and tried many different things (writing and reading up from tutorials) regarding long polling around the net with no solid results regarding writing up the server side php when trying to long poll. I have my client side and server side code set up..Only I have a few issues.

The call [...]

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories