I have an issue.. I created a php script that generates random number: the script goes thus:
</head>
<div id="inner-content">
<form action="" method="post" name="form1">
<fieldset>
<legend>Please click on the button to generate a random number</legend>
<input type="submit" value="Generate" /><br />
<?php
$length = 10;
$randomString = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
echo "$randomString";
?>
<p>
<input type="button" name="button1" value="Save" />
</div>
</fieldset>
<body>
</body>
</html>
Now i have have two serious worries: 1) How do i trap the generated number and save it into a database owing to the fact that the submit button is the one generating the random number. I want a situation whereby when we click save, the number goes into the database.
2) I have two tables,(table A and table B, table A saves all the information being entered and submitted by the user, table B has the generated codes, table A will love to validate a particular field from the form and validate the code in table B, then if codes matches, the user can submit, else the user gets an error and asked to fill in the correct code which resides in table B.also, i have the controller from table A which saves the form. here's the form.