php

Any ideas why this wont print out

Revising for php and cant seem to get this to print the values out that i want Any ideas? Thanks <form action="revision.php" method="GET"> <input type=“text” name=“number[]”/> <input type=“text” name=“number[]”/> <input type=“text” name=“number[]”/> <input type=“text” name=“number[]”/> <input type=“text” name=“number[]”/> <input type=...

Apache complex regex crashing with 500 error

I have been working with an existing website out company has running until I finish developing the new site. I've been asked to add some additional functionality to booking pages that will automatically set a booking button based on passed parameters. The existing working regex is as follows: RewriteRule ^.+-(\d+)\.accommodation$ prop...

PHP OOP Design Patterns: Should I Create two seperate classes for registration and form validation?

So here's my problem: I have two types of registration, registration A and registration B, each will have some of the same fields and some different fields. I was going to create abstract class registration and both A and B would have their own classes that extend from registration. My question is, should I create a seperate Validatio...

PHP sort multidimensional array by value

How can I sort this array by the value of the "order" key? Even though the values are currently sequential, they will not always be. Array ( [0] => Array ( [hashtag] => a7e87329b5eab8578f4f1098a152d6f4 [title] => Flower [order] => 3 ) [1] => Array ( [hashta...

weird array syntax

I'm trying to figure how a function I've been given works -- or rather doesn't work. The problematic areas include array notation like this: $small[$end[$i]{0}] I think the idea is to append "0" to the value of $end[$i] and use that for the index of $small. But it doesn't work in PHP5.3. Is this a deprecated syntax and is it trying t...

Execute javascript in PHP

I'm generating your typical Web 2.0 HTML page with PHP: it contains a lot of <script> tags and javascript code that will substantially change the DOM after the load event. Is there a way to get the final HTML code directly from PHP, without opening the page with any browser? For example, let's say the HTML for the page is (it's just an...

Wordpress and Jquery slide

I am integrating a Jquery slider inside of wordpress here is the demo of the slider. I can see the div that is their but for some reason it is not showing up. View the working site here Now my problem is that this code: <script type="text/javascript"> var _siteRoot='index.php',_root='index.php';</script> <script type="text/javascrip...

PHP's openssl_sign generates different signature than SSCrypto's sign

I'm writing an OS X client for a software that is written in PHP. This software uses a simple RPC interface to receive and execute commands. The RPC client has to sign the commands he sends to ensure that no MITM can modify any of them. However, as the server was not accepting the signatures I sent from my OS X client, I started investi...

multi-dimension array value sorting in php

Another potentially interesting (or n00b, whatever comes first) question. I am building up an array with a set of database fields with information about table, actual field name and descriptive field name as a multi-dimensional array. Here is what it currently looks like: $Fields['User']['ID'] = "User ID"; $Fields['User']['FirstName'] ...

Numbers to string and vice versa in PHP

How do I convert numbers to a string and vice versa in PHP? ...

PHP, Building ID'd array from non-incremental ID'd CSV

Basically, here is my CSV File: 1,"Gold" 2,"English Version" 10,"Sword+0" 11,"Sword+1" 12,"Sword+2" And so on, you get the idea. There are other parts where the ID is not incremental, perhaps one is 2899 and then the next one is 3020. I'm trying to build an array from this with fgetcsv();. I can do it fine, but I've failed so far to m...

PHP Fatal error: Cannot re-assign $this

I get this error for the code below, what does it mean? [Fri Apr 23 10:57:42 2010] [error] [client 10.0.0.1] PHP Fatal error: Cannot re-assign $this in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\abp\fol\test.php on line 27, referer: http://abp.bhc.com/fol/ <?php $voiceboxes = array( '141133' => array( ...

Could someone critique my PHP register/validation classes?

http://pastie.org/931617 is a link to the source code. If there is a better way to do this, let me know. One thing I'm unsure about, is the way I handle child/parent constructs in the validation classes towards the bottom. Thanks. Ok, I took your advice using an associative array. Now, I just toss the $_POST variable to my construct...

Did I find a bug in PHP's `crypt()`?

I think I may have found a bug in PHP's crypt() function under Windows. However: I recognize that it's probably my fault. PHP is used by millions and worked on by thousands; my code is used by tens and worked on by me. (This argument is best explained on Coding Horror.) So I'm asking for help: show me my fault. I've been trying to fin...

jQuery: Use of undefined constant data assumed 'data'

I am trying to use jQuery to make a synchronous AJAX post to a server, and get a JSON response back. I want to set a javascript variable msg upon successful return This is what my code looks like: $(document).ready(function(){ $('#test').click(function(){ alert('called!'); jQuery.ajax({ async: false, type: 'POS...

How to the values of an array to populate the keys of another array?

I have an array of field names. I would like to use those to populate the keys of another array, which will have empty values as default. Is there a single command I can do this with? ...

PHP Array - How to loop through an array

Hi My array is as follows: Array ( [questions] => q1 [qnum] => 1 [qtext] => I love crisps [page] => 1 ) Array ( [questions] => q2 [qnum] => 2 [qtext] => I love chocolate [page] => 1 ) All I would like to do is print the contents of the array in a loop, so it looks something like: q1 1 I love crisps q2 2 I love chocolate If anyone ...

PHP - How can I write better code with E_NOTICES enabled?

I prefer to develop with E_NOTICES turned on, but I often have to write excess, overly verbose, code when working with array indexes. How can I write this code in less code with E_NOTICES enabled. With notices suppressed if ($_REQUEST['some_key'] == 'bob') { } Without notices suppressed if (array_key_exists('some_key', $_REQUEST) &...

Is there a common method for implementing pagination through PHP data objects?

I am going to be implementing a small custom CMS for a website. I was wondering if there are any more popular methods for implementing pagination using OOP. Thanks! ...

Neither if nor else will run

I don't know what the problem is. This is the code that is the problem: $thisvb = (int) $key2; if ($thisvb == ($lastvb + 1)) { //This don't work echo '<li>'; } else { echo '<li value="' . $key2 . '">';} $last = (int) $key2; Below is the full code. <?php $voiceboxes = array( '141133' => array( '1' => array( ...