php

Loop through form input arrays in php

Hi I'm building an app in CodeIgniter. I have an invoice form which uses jQuery to create new line items. The line items are formated as follows: <input type="text" name="invoice[new_item_attributes][][description]" class="ui-corner-all text invDesc" title="Description" /> <input type="text" name="invoice[new_item_attributes][][qty]" c...

$_GET and $_POST not working

I am a beginner in php and am trying some very simple tests to get started. I seem to be unable to get any values from $_GET. This test.php #!/usr/bin/php <html> <body><h1>GET test</h1><p> <?php print_r($_GET); ?> </p></body></html> produces the following when called with http://my.url/test.php?aValue=A&amp;bValue=B <html> <bo...

How to display a members info and articles to a visitor using PHP and MySQL?

I was wondering how can I display a members article they created and show it to visitors all while displaying the members info that is associated with that article to the visitors. I hope I explained it right? Here is my mysql articles table. CREATE TABLE authors_articles ( id INT UNSIGNED NOT NULL AUTO_INCREMENT, author_id INT UNSIGN...

Kohana Error... Attempt to assign property of non-object

So I'm trying to go through the Version 3 Guide of Kohana and keep getting an error on the hello world create view part. ErrorException [ Warning ]: Attempt to assign property of non-object Line 8: $this->template->message = 'hello world'; I placed the site.php in the application/views folder... is this the wrong place...? The code.....

When can there be data in both $_GET and $_POST

Is it actually possible to get data in both $_GET and $_POST? And how does this relate to what is in $_REQUEST? ...

Form Inputs updated via JS don't get submitted

Hi, The invoice input values which hold the totals of invoice line items that get updated via JS return a NULL value when they are submitted. <span class="sublabel">Subtotal</span><input type="text" class="total-box" id="product-subtotal" readonly="true" /> <span class="sublabel">Tax</span><input type="text" class="total-box" id="produ...

Any good PHP IDE/text editor with FTP support?

I need to find a stable PHP IDE/text editor that have theses features: Class/function list (like the Outline in Eclipse) Code completion FTP Support Fast Stable I've tried Eclipse with RSE and PDT, crashes and hang way too many time when using FTP. NetBeans is quite good but the GUI is horrible and slow. Aptana, my favorite IDE, but ...

How to display the date and time with PHP and MySQL?

Okay I kind of know how to display the time with PHP and MySQL but I need a little help. I want to display the time something like this in the example below. August 5, 2010 @ 8:47:28 PM Here is the code I have so far that is listed below. date('F j, Y', strtotime($date_created)) ...

How to pull "most recent post" data from a Wordpress blog?

I have two Wordpress blogs. I want to pull the "5 most recent posts" from the first blog with post title, date, and link to post and display this data on the other. I don't know if there is a plugin that does this sort of thing already, but just wondering how I can achieve this. ...

Checking a string against a pattern

I want to check posted content against a pattern. I am having trouble setting up this preg_match (or array?). The pattern being... TEXTHERE:TEXTHERE TEST:TEST FILE:FILE AND TEXTHERE:TEXTHERE TEST:TEST FILE:FILE I want to check for either pattern, the one with the whitespace and the one with the line break. If the posted content is...

How should I store a user's LDAP password in a cookie?

So I have this black box authentication method, handed down to me from the accounts people, which basically amounts to ldap_bind($connection, $username, $password). But of course, I want my users to be able to log in for, say, 30 days at a time. The naive but insecure way to handle this is to store the username and password in plaintext...

Is there any benchmark which compares PHP and JSP?

I don't want to make a holy war. I just want to know if there is such benchmark? Or maybe you can say something about this thread from your experience? ...

cakephp save array

what would be the efficient way of saving the following array using php (cakephp)? each value needs to go into a new row in the table? Array ( [0] => 6786754654 [1] => 5643564545 [2] => 344544545 [3] => 233245654654 [4] => 453454654654 [5] => 6546542323 [6] => 654654654 [7] => 645654654 etc.... ) t...

Not able to calculate in XSLT after switching the PHP locale

To get "," instead of "." as a decimal point, I set the locale via setlocale("de_DE");. When I now transform an XSLT stylesheet that contains a calculation like: <xsl:variable name="a"> <xsl:choose> <xsl:when test="$someboolean"> <xsl:value-of select="0.5"/> </xsl:when> <xsl:otherwise> <xsl:value-...

array transformation in php

how would you turn this array: Array ( [0] => 234234234 [1] => 657567567 [2] => 234234234 [3] => 5674332 ) into this: Array ( [contacts] => Array( [0] => Array ( [number] => 234234234 [contact_status] => 2 ...

What's the proper MVC way to do this....?

Quick question about general MVC design principle in PHP, using CodeIgniter or Kohana (I'm actually using Kohana). I'm new to MVC and don't want to get this wrong... so I'm wondering if i have tables: categories, pages, notes I create a separate controller and view for each one...? So people can go to /category/# /page/# /note/# ...

PHP right shifting and negative result?

Hi, I've run into a problem whilst converting some C code to PHP, specifically in the use of the right-shift operator. edit: in the following examples, bit = 0; Original C code: p->param->outBits[bytePtr++] |= codeword >> (9 + bit); PHP code: $outBits[$bytePtr++] |= $codeword >> (9 + $bit); If I start with codeword being 130728,...

How to get the current Joomla username?

Hey, I'm trying to get the current Joomla username. I was able to get it by using $user =& JFactory::getUser(); echo $user->username; But now I've installed Joomla on my local server and it doesn't work anymore. The usernames are correctly stored in the database, but the code just doesn't work anymore. Any ideas? Thanks ...

Does PHP support asynchronous programming?

I'm new to PHP. I am familiar with ASP.NET which support asynchronous programming. That is, if one request needs to do some I/O job. It is suggested to program the web page with BeginProcess/EndProcess way. The asynchronous programming is key to improve scalability. I'm wondering whether there is counterpart of asynchronous programming(...

PHP base navigation help

Hello, currently i have : $page = basename($_SERVER['REQUEST_URI']); <li<?php if($page == 'index.php?page=product') print ' id="current"'; ?>><a href="index.php?page=product">Products</a></li> but however when url is something like index.php?page=product&item=100 the class 'id=current' doesn't apply. any workaround? thank you fo...