Hi folks, thanks for the responses. I made a little progress... quite a bit actual, I think. I got the form setup and PHP writing to the DB. I played around with hakimserwa's code a bit, but was unable to have any luck getting any of the JavaScript to work. Also, with the onClick, how would i prevent it from leaving index.php and going to frmgen.php ?
Heres what I accomplished since my original post.
btnGen, exicuting code to return variables to later use -- Works!
btnGen, writing variabls to DB -- Works!
"confirm txtAddr is equal to a variable" -- Ended up using a JSON response, $isvalid below. Works!
The variables that im interested in from frmgen.php are the 3 below. I would like to have those variables populate the labls and text fields in index.php
$newAddress --> populate txtAddr in index.php
$Key --> populate txtKey in index.php
$fee --> populate txtFee in index.php
index.php
<form id="frmGen" method="post" action="frmgen.php" >
<label>Destination Address:</label>
<input name="txtDest" type="text" maxlength="34" class="txt" value"1234567890QWERTYUIOP0987654321WWWX">
<label>Random Key:</label>
<input name="txtKey" type="text" maxlength="10" class="txt" value"1234567890">
<label>Address:</label>
<label name="txtAddr" class="txt"></label>
<label>Fee:</label>
<label name="txtFee" class="txt"></label>
<label>Generate Address:</label>
<input name="btnGen" type="submit" value="Generate Address">
</form>
frmgen.php
<?php
$DestAddr = $_POST['txtDest'];
include("RPCConnect.php");
$isvalid = $RPCtool->validateaddress($DestAddr);
$account = ("queue"); # Variable just incase needed later
if ($isvalid['isvalid'] == "1") {
echo "valid"; echo("<br>");#Continue code here.
echo $newAddress = $RPCtool->getnewaddress($account); echo("<br>"); #Store $newAddress in DB
echo $Key = ("RandomKey"); echo("<br>"); #Store vKey in DB
echo $fee = mt_rand (15,30)/10, "%"; echo("<br>"); #Store fee in DB
include("sqlcon.php");
mysqli_query($con,"INSERT INTO TABLNAME (Key, ipAddr, LocalAddr, DestAddr, fee)
VALUES ('$Key', '$ip','$newAddress', '$DestAddr', '$fee')");
mysqli_close($con);
}
else{
echo "This is not a valid string. Please provide a valid address."; #ooples
}
?>