Questions tagged as 'php'

3
answers

Check if there is a character within a text

I have the following code: if($_POST['Submit'] == "Enviar"){ $explodir = explode(";",$_POST['Emails']); foreach($explodir as $exp){ echo $exp."<br>"; } } <form method="post" name="form"> <textarea rows=...
asked by 13.10.2015 / 19:23
3
answers

How to add a PHP variable only if it is set?

I have some scripts that do some calculations with data coming from a form, and to make the sum of them all I created another file where I make the sum: include "varios.php"; $total = $var1 + $var2 + $var3; /// etc However, I want to only...
asked by 30.10.2015 / 00:32
2
answers

How can I make a validation to check if a variable is empty and is a string in php

I want to do a negation check and then the else hit. How can I do it? See the example! <?php $a = ''; if(!$a && !is_string($a)): echo 'False'; else: echo 'True'; endif;     
asked by 29.08.2015 / 15:56
3
answers

Loop output within another loop with SQL and PHP

I have these values in my SQL database, I want an output this way and this file in the browser using PHP Database structure with the values I want on the output My attempts, although it does not help you at all: pastebin.com/6tCNbpY4 DA...
asked by 26.05.2014 / 18:41
1
answer

Sessions in PHP

I'm working on a system that has a 'search filter' on the home screen. For that, in my header I put a select / combo box and an 'OK' button. To handle this I decided to use sessions, where I can save the value that the guy chose and use on al...
asked by 19.09.2014 / 05:20
2
answers

Know if user is logged in PHP

I want a user when logged in, so that nobody can log in to the system with the same login and password. That is if the admin is connected, and open another browser and open with the same user admin, do not leave me. I created a field in the tabl...
asked by 07.11.2014 / 12:56
2
answers

property name textarea name="q1" to name="q20" + php

I need the property name="q1" to generate a string, like this: <textarea name="q1"></textarea> <textarea name="q2"></textarea> <textarea name="q3"></textarea> . . . <!-- // Até --> <textarea...
asked by 03.10.2014 / 18:58
3
answers

How do I use a constant within a method of a class?

I set a constant in a file and would like to call it inside a method in a class. Example: File: Configuracao.php <?php define('FOO','Hello World'); require_once('Classe.php'); ?> File: Classe.php <?php namespace...
asked by 09.12.2014 / 19:04
4
answers

Take accentuation of a string

I am getting a string by POST, and I want to take accent and add '_' if there is white space. I used strtr but it does not work for me. if (isset($_POST['txtnome'])) { $txtnome= htmlentities($_POST['txtnome']); } $aa = strtr($txt...
asked by 11.12.2014 / 12:16
2
answers

Leave manageable site text

I developed a one-page layout which the client requested that a part of the site be manageable, something that was not in the project at first. It is a simple line between <p> and </p> What's the easiest way to do...
asked by 27.10.2014 / 23:10