Questions tagged as 'php'

3
answers

php always returns 0

I'm doing a calculation for php, picked up with jQuery and passed in ajax. All this within a wordpress (I think this does not influence the failure). After filling 3 fields (1 input and 2 select) you must send it by ajax and the php add the valu...
asked by 06.07.2018 / 18:23
4
answers

Pass JavaScript variable to PHP? [closed]

By means of a combobox (loaded by names of a database using a while I made a function of javascript that when I choose a name of combobox I bring in a separate input the card of that name . I have read about js...
asked by 22.12.2016 / 17:46
2
answers

How to filter that the name of a file does not exceed a character length in the browser or in PHP?

I want to save the name of a PDF file in a column of a database. The name of the column is nombre_pdf with a varchar(50) and the problem I have is that if the nombre_pdf exceeds the limit of 50 characters, the whole name wil...
asked by 31.05.2017 / 19:40
1
answer

How to create select for each element in an associative array that I receive as a response to an ajax post

I am working on a website with CodeIgniter, I need to create a select for each element I receive in an array or json. I do not know which is the best option as a response to a post I do with ajax. The problem I have is that I receive an array li...
asked by 05.10.2016 / 16:18
2
answers

Problem with header () in PHP

I have this warning:    Warning: Can not modify header information - headers already sent I do not know what may be wrong with header. This is my code: <!DOCTYPE html> <!-- * * @author Zarate --> <?php in...
asked by 08.01.2018 / 03:06
1
answer

List the folders of a route (get subdirectories)

What I'm looking for is to make an array that contains only the names of folders (directories) of a given route. I tried scandir (): $scan = scandir(realpath(__dir__)); for ($i = 0; $i < count($scan); $i++) { if (is_file(dirname(__fi...
asked by 12.02.2018 / 23:44
2
answers

Convert "if (isset ())" to the conditional "? : "(Ternary operator)

I have this code: if (isset($array[$a]['estado'])) { echo "True"; } else { echo "False"; } I want to know if I can pass it to the conditional format ? :     
asked by 16.11.2016 / 10:50
2
answers

php to establish connection to the database

hello community I'm just learning the object-oriented programming for reasons of scalability in my application and well I have this code to establish connection to the database .. file config.php $host="localhost"; $user="root"; $pass="";...
asked by 09.09.2018 / 00:33
1
answer

JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 13 of the JSON data

I have a problem with receiving a JSON file from a PHP to a Jquery:    SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 13 of the JSON data In my PHP I have: <?php if(isset($_POST['id_part...
asked by 09.08.2018 / 11:23
2
answers

How can I add hours and minutes?

What I'm looking for is a button that when I click on it, I add the hours and minutes of each record and its total appears in a field, this script is only doing the query of the hours but I do not know how to add them. <?php echo "<b...
asked by 28.05.2018 / 15:06