Trimming HTML template fields in PHP

I have a form setup like this: <form action="/clients/{{ $client->id }}/create-invoice" method="post"> <div class="form-group"> <label for="due_date" class="sr-only">Due Date</label

Convert a multidimensional array to a single dimension

This is the array as I currently have,please convert it to the below array with single dimensional array:- Array ( [0] => Array ( [is_custom] => yes ) [1] => Array ( [custom_amount] => 45 ) [2] => Array ( [custom_amount_text] => Enter Am

Laravel counts results on a specific date and column

In my database I am having the following records: id code product_amount created_at 1 ORD-1 250 2016-04-04 05:15:05 PM 2 ORD-1 150 2016-04-04 05:15:05 PM 3 ORD-2 450 2016-04-05 11:18:17 PM 4 ORD-3 250 2016-04-06 04:30:25 PM 5 ORD-3 300 2016-04-06 04:

Can not get the same value in the PHP array

I can't seem to get the same value in array. The first value just doesn't appear in the output. The code compares the id's and joins the values that match the id.This is my code: <?php $pic = array ('1.jpg','2.jpg','3.jpg'); $picid = array('aqua','gr

Symfony2 - Highcharts rendering an empty partition

I have just installed the Highcharts Bundle on Symfony 2.7, but I am already facing an issue while trying to reproduce the "Usage Example" from the documentation (cf https://github.com/marcaube/ObHighchartsBundle/blob/master/Resources/doc/usage.

using an eloquent model property in subquery with function

My question may be confuse because I've started learning Laravel. Can I use eloquent model property in subquery of with() function? I have classes, students, and grades tables. I wish to get $classes = [{id:1, name:'maths', students:[{id:2, name: joh

Pass a php variable to jquery as argument

I have a question, how to pass val.idno after firm/editFirm/ so I need to do firm/editFirm/val.idno.Help me please guys.My jquery: $.each(obj, function(i,val) { $('#finalResult').text("Results"); items.push($('<li/>').text( val.name_firm +

Symfony2 installation problems

I'm new to Symfony2 and I'm trying to create a new project in my local environment following the steps listed in the Symfony book: Download $ curl -s http://getcomposer.org/installer | php $ php composer.phar install Create Project (path relative to

Escape Javascript in PHP

I am Trying to escape these darn quotes and stuff in JS. I'm trying to use json_encode. My head hurts from looking at quotes, help??? $list = ''; // some loop here $message = 'centeredPopup(this.href,"myWindow","500","300",&q

Show link to if / else and option selected

I have been struggeling with this for a couple of hours and my head is exploding at this point. My programming skills are very low, so this should be an easy one for you. I want to use an if/else statement with a selected option from a select menu to

save cropped image with PHP

I have this script which crops the image. How do i save it to the server? move_uploaded_file($_FILES["file"]["tmp_name"], "pictures/" . $_FILES["file"]["name"]); $imgSrc = 'pictures/' . $_FILES["file&

Session cache limitation

Yes I know this has already been done, but this problem is different. The error I get is: Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/u5558315/public_html/admin/index.php:1) in /home/u55

The database does not update

For some strange reasons, the database doesn't update. I can get the information, but it doesn't get updated when I click submit. Is there anything missing. <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpwd = 'ALLO'; $dbname = 'test_db'; $con = m

several sub-pages with the same upper bar

I have a webpage with several subdirectories for example /search or /friends. Each of this subpages has its own javascript and css files. Now I want all this pages to have the same topbar so if I wanted to change the topbar I would only have to do th

Extension of PHP and Intellisense HTML tools

I got the PHP Tools professional version, but realized that it only has php intellisense, and that it only has color highlighting for HTML. While html itself admittedly isn't difficult, I would like to have intellisense for it as well. Does anyone kn

PHP Post / Redirect / Get Failing with Google Chrome

I have tried to implement the POST/REDIRECT/GET design pattern in PHP and it works with Safari but not Google Chrome (for Mac) when I redirect to the exact same page. If I vary the URL slightly (say adding a trailing-slash) it works fine. Here is a f

Unable to find escape string in database

This question already has an answer here: I have an array of integers, how do I use each one in a mysql query (in php)? 5 answers In the database I have a string like this: Caisse primaire d'assurance maladie Now when I try to look for it in my PHP s

Date PHP indicating "1970-01-01" after conversion

I have a form in which date format is dd/mm/yyyy . For searching database , I hanverted the date format to yyyy-mm-dd . But when I echo it, it showing 1970-01-01 . The PHP code is below: $date1 = $_REQUEST['date']; echo date('Y-m-d', strtotime($date1

Unable to access the global variable in the included file

I am having an unexpected issue with scope. The include documentation (also applies to require_once) says the required file should have access to all variable at the line it was required. For some reason I am not able to access a class instantiated w

Exhaustive Memory - Loops Fixed tried, still does not work

I'm currently experiencing a memory usage issue - but I cannot figure out where. I've tried replacing some of my foreach loops with for loops or by issuing another query to the DB, but I am still gettting the same error - "Fatal error: Allowed memory

PHP Parse iCal Reminder String

I'm currently working on parsing iCal reminder strings, similar to: -P14DT0H0M0S Using PHP, how might I be able to parse the elements of the string so that if I had: <? $reminder = "-P14DT0H0M0S" // somehow output to show "-2 weeks"

PHP version of the property attribute class ASP.NET/C#

Is there such a thing? I'd like to do something like this in PHP but I can't see how to do it from the PHP docs: public class User : ValidationBase { [NotNullOrEmpty(Message = "Please enter a user name.")] public string UserName { get; set; } }

Competition Memcached w / lighttpd php

I'm having an issue with memcached. Not sure if it's memcached, php, or tcp sockets but everytime I try a benchmark with 50 or more concurrency to a page with memcached, some of those request failed using apache ab. I get the (99) Cannot assign reque

Can you get a Windows user name (AD) in PHP?

I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible?Check the AUTH_