array
with predefined values and the rand()
function of PHP. The problem is that the value
attribute of input
is showing PHP code instead of using the variable's value itself. 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 folks, thanks!