here is my code that generates random characters
How can i get this random characters when i click my button 'submit' . and get that as a variable to save on database. please help
this is my button
<span class="input-group-btn">
<button class="btn btn-info" type="submit" name="submit">POST</button>
</span>
this generates random characters
<?php
$result = "";
$chars = "abcdefghijklmnopqrstuvwxyz0123456789";
$chararray = str_split($chars);
for($i = 0; $i < 7 ; $i++){
$randitem = array_rand($chararray);
$result .= "".$chararray[$randitem];
}
echo $result;
?>
i want to get that random character as a variable like $post_randomid = $_POST[random_id];