Jump to content

airborne305

New Members
  • Posts

    4
  • Joined

  • Last visited

airborne305's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. 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 } ?>
  2. Hi, thanks for your response. great help for a newbe. :-)
  3. Hello! Second post here. I'm new to PHP and have an idea of what needs to be done, but im not sure the best way to impliment it. Basically im looking for direction on whether I should use JS, AJAX, Jquery, or something else. from browsing around im guessing its going to be a combination of AJAX and Jquery to get this accomplished. Please advise on the best method to acomplish this. Thanks =) The user needs to populate txtAddr and hit btnGen. The function will then confirm txtAddr is equal to a variable. If it is equal, populate other 2 text fields (txtKey & txtDest) with predefined variables. <form action="frmGen" method="post"> <input name="txtAddr" type="text"> <!-- User enters text here -- Confirm txtAddr.text = $VarAddr -- If True, continue. If False, display DIV message --> <input name="txtDest" type="text"> <!-- Text field is filled with value from server/SQL when btnGen is pressed--> <input name="txtKey" type="text"> <!-- Text field is filled with value from server/SQL when btnGen is pressed--> <input name="btnGen" type="button"> <!-- assuming txtAddr is True, display strings in 2 text fields above & store all values from 3 text boxes in SQL --> </form>
  4. Sorry if my wording/terminalogy on the discription is wrong. I'm new to PHP, so i'll do my best to detail what im trying to do. The PHP is doing what i need it to do. But i do not need to print the whole response. I only need the [address] and [pubkey] values as variables. I have read a few tutorials, but they assume i already know the strings to be converted to variables. Please help Code... <?php require_once 'jsonClient.php'; $service = new jsonClient('http://ooples:booples@127.0.0.1:18332/'); $apple = array ($service->validateaddress("1234567890")); print_r ($apple); ?> Response... Array ( [0] => Array ( [isvalid] => 1 [address] => 1234567890 [ismine] => 1 [isscript] => [pubkey] => hqwiuehf9 [iscompressed] => 1 [account] => foo ) )
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.