2
Speak my friends night programmers, well my doubt is the following, I’m trying to fill an HTML form with random values, for this I’m using a array
with predefined values and function rand()
PHP. The problem is that the attribute value
of input
is showing the PHP code instead of using the value itself of the variable. The code is as follows::
<?php
$randomName = Array("Alice", "Thor", "Pereirinha", "Golias", "Poseidom", "Morpheu", "Titio avo");
$randomValue = rand(0,6);
$nome= $randomName[$randomValue];
echo $nome;
?>
<form name="form1" action="registrarusuarios.php" method="post">
<fieldset>
<legend>Dados Pessoais</legend>
<!-- label: for se refere ao id do input -->
<label for="nome">Nome:</label>
<input type="text" name="nome" id="nome" class="texto" value="<?php echo $nome; ?>" /><br/>
Well that’s it guys, thanks!
What is the? PHP or HTML file extension? does the first part of PHP also appear on the client side? or just what’s on
value
?– Sergio
Hi Rafael, please mark one of the answers as accepted if she was the most important to resolve the problem. Thank you!
– bfavaretto