I am using Twitter Bootstrap to build a web application. I have a form where user should enter his name and last name and click submit. The problem is, that the $_POST comes back empty. I am using WAMP on Windows 8 machine. Thanks in advance Answer Add names to the input types like Now check the $_POST variab…
Loading Doctrine entities in postLoad
I have an entity which implements a postLoad lifecycle event method. This method conditionally updates the entity and attempts to save it. Something along the lines of: However, I’m receiving the following error: It seems I’m unable to save an entity during postLoad. I stumbled across this ticket …
Json Parsing and inserting to mysql
I am using the the Mandrill to post any inbound emails. Here is what is posted by Mandrill when i receive a new email -> http://help.mandrill.com/entries/22092308-What-is-the-format-of-inbound-email-webhooks- Also here is what i get in the $_REQUEST (sorry that its not formatted well): [{“event”…
How can I replace a variable in a string with the value in PHP?
I have string like this in database (the actual string contains 100s of word and 10s of variable): I echo this string like this: My output is I am a {$club} fan. I want I am a Barcelona fan. How can I do this? Answer Use strtr. It will translate parts of a string. For multiple values (demo): Program Output:
What is the best way to read last lines (i.e. “tail”) from a file using PHP?
In my PHP application I need to read multiple lines starting from the end of many files (mostly logs). Sometimes I need only the last one, sometimes I need tens or hundreds. Basically, I want something as flexible as the Unix tail command. There are questions here about how to get the single last line from a …
why select option value if zero post empty
I am sorry bad English. I have a select menu option value problem: I am if select value=”0″ option and this post, it retuns the value with no problem. But, when I use value = 0 save mysql table, this value not 0 this return empty. This value saving column type integer? What is problem? I am not us…
How to get closest date compared to an array of dates in PHP
This post almost answered this question for me, but I have a specific need and didn’t find what I sought there. This lies right outside my experience; couldn’t quite wrap my head around it, so all I really need is a point in the right direction. Let’s say I have an array as follows: I would …
Can you override interface methods with different, but “compatible”, signatures?
Consider the following PHP interfaces: I’m using PHPStorm, and when I do this, I get an error in the IDE that basically states the definition for add() in SuperCollection is not compatible with the definition in the interface it extends, Collection. In one way, I can see this being a problem, as the sig…
Custom mysqli prepare function
I’m doing my first own database class at the moment and currently I’m doing the prepare function. What this function does is to take in an SQL-query and then an array containing the variables for the …
cURL request using socks5 proxy fails when using PHP, but it works through the command line
cURL + proxy noob here, having a hard time. I’m having trouble trying to retrieve a web page from a remote secure server via a proxy. Everything has apparently been set up correctly by a remote dev, …