I have got this code on page1.php:
<form action="mcgen.php" id="form1" method="POST">
<input style="margin-right:-160px;" name="name1" type="text" id="form-field-1" placeholder="username:password" class="form-control" value="<?php echo $line ?>">
</div>
<button style="margin-right:-160px;" type="submit" name="gen" id="gen">Generate</button>
The mcgen.php file has this code:
<?php
if(isset($_POST['gen'])){
$f_contents = file("001.txt");
$line = $f_contents[array_rand($f_contents)];
$data = $line;
list($first, $last) = explode(':', $line);
}
?>
I am trying to make it so after they click the "Generate" button it will run the code in mcgen.php and then return to page1.php and echo "$line".