friends,
I do not know practically nothing of PHP, I would rely on help from friends of the forum.
In the code below would like to bring the variable UF loaded with a default value, EXAMPLE: UF = "PR"
/></td>
<td >UF:<br />
<input name="uf" title="Informe o estado" type="text" class="campoCadastro" id="uf" value="<?=$_POST['uf']?>" maxlength="2" style="width:25px;
<?php
$nomeCampoVerifica = "uf";
if($_POST["ACAO"]=="novoCadastro" && $_POST[$nomeCampoVerifica]==""){?>
border:1px #F00 solid;
<?php }; ?>"
/></td>
Muito obrigado
PHP variable default value
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: PHP variable default value
Code: Select all
<?php
$uf = 'topic';
// will echo UF: topic
echo 'UF: ' . $uf;
?>“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Re: PHP variable default value
thanks for replying.
only blank, something like this:
<?php
if empty($UF){
$uf = 'topic';
}
// will echo UF: topic
echo 'UF: ' . $uf;
?>
only blank, something like this:
<?php
if empty($UF){
$uf = 'topic';
}
// will echo UF: topic
echo 'UF: ' . $uf;
?>
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: PHP variable default value
You can also define $UF if you want; uppercase letters are normally used for constants and if you do have $UF and $uf they are 2 different variable as variable names in php are case-sensitive.
http://www.php.net/manual/en/language.v ... basics.php
http://www.php.net/manual/en/language.v ... basics.php
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering