Questions tagged as 'php'

2
answers

Blade laravel and the performance

In Laravel , we usually use Blade to be able to write a view . Example: @unless($variable) <p>Nenhum dado encontrado</p> @else @foreach($variable as $v) <p>{{ $v }} </p> @endforeach @end...
asked by 01.10.2015 / 14:19
2
answers

Best way to make a script to logout

I am developing a system in which it is accessed with the login and password, once logged in the user has the option to log out, below my script: if(isset($_SESSION['logado'])){ session_destroy(); header("Location:index.php"); } I w...
asked by 01.09.2014 / 05:14
4
answers

Know if there are any blanks

Good community! I have the following doubt. How can I warn the user that there are white spaces in the username field? Here's how I'm validating username now: if (empty($_POST["username"])) { $nameErr = "Escolha um username."...
asked by 27.01.2016 / 01:31
4
answers

Leave last 12 records and delete the rest in PHP / MySQL

I would like to make sure that after the script runs, there may only be the last 12 records in a specific table that has the date field in international format if you can assist. <?php # Este pequeno script PHP recupera o OD do imóvel visi...
asked by 29.09.2014 / 18:14
2
answers

Toggle colors in table with PHP [duplicate]

I have a code that displays a table in the% list of registered%, and to embellish, the code causes it to display 1 in 1 by alternating the colors between white and gray. COR -> White COR -> Gray COR -> White COR -> Gray ... How ca...
asked by 29.07.2015 / 19:14
3
answers

How to know the names of array positions in php?

I submit the javascript 2 arrays with the following data: values = {'tipoLicenciamento':tipoLicenciamento,'modulo':modulo} ; values = {"modulo":modulo,"categoria":6}; In my php I get something like this when I give printr() Array (...
asked by 18.09.2017 / 20:04
3
answers

Parse error: syntax error, unexpected {[closed]

I have a PHP file to check if SESSION is set: <?php session_start(); if(isset($_SESSION['user']){ echo "<script>document.location.href='../areaprivada.html';</script>"; } else{ echo "<script>document.location...
asked by 09.07.2015 / 18:38
4
answers

How do I delete only 1 form field?

I have a company invoice bar code entry form, which has fields such as driver, used car on delivery, and so on. So that at the time of entry, the user does not have to fill in the information for each note, I use: body onload='window.history.b...
asked by 17.01.2018 / 12:54
2
answers

Accent on comment field

I need a help for a situation that seemed simple to me, I have a form with a comment field and when I send this comment by email it appears all unconfigured, I'm using phpMailer. The code page on the contact page looks like this: <meta h...
asked by 20.06.2014 / 14:37
3
answers

How can I return zero in front of other numbers? [duplicate]

I have a record in my BD MySQL, example: A0001 and I need to get this value and add example A0001 + 1 = A0002 . I've done the following: $texto = "A0001"; $novotexto = substr($texto, -4); $soma = ($novotexto+1); ec...
asked by 05.02.2018 / 14:15