crooksey Posted September 20, 2010 Share Posted September 20, 2010 I have two forms that I have created. I wonder if someone could point out where I am going wrong, all data is commented so it should be easier to understand. form1.php <?php $digest = 0; $amount = 0;$trans_id = 0;$merchant = "so"; $remotepassword = "s0"; if ($_POST) { $digest_this = $_POST['trans_id'] + $_POST['amount'] + $remotepassword; //combine all my values to be md5'd $digest = md5($digest_this); //generate the md5 hash $amount = $_POST['amount']; //what I think I am doing here is posting the data so it can be retrived $trans_id = $_POST['trans_id']; //by a get request on from 2, this is where I need help $merchant = $_POST['merhcant']; $remotepassword = $_POST['remotepassword']; } // end $_POST?> <form action="part2.php" method="post"> <p> <label for="trans_id">Invoice Number(s): </label> <input id="trans_id" type="text" name="trans_id" /><br /> <label for="amount">Amount Paying: </label> <input id="amount" type="text" name="amount" /><br /> <input value="Send" type="submit" /> <input type="reset" /> </p></form> form2.php <?php if ($_GET) { $digest = $_GET['digest']; //here I think I am retriving the data I sent with a post request $merchant = $_GET['merhcant']; //and then storing it in variables $remotepassword = $_GET['remotepassword']; $amount = $_GET['amount']; $trans_id = $_GET['trans_id']; } // end $_GET?><form action="https://www.secpay.com/java-bin/ValCard" method="post"> <p> <label for="firstname">First Name: </label> <input id="firstname" type="text" name="firstname" /><br /> <label for="lastname">Last Name: </label> <input id="lastname" type="text" name="lastname" /><br /> <label for="account">Account Number: </label> <input id="account" type="text" name="account" /><br /> <label for="housenumber">House Number/Name: </label> <input id="housenumber" type="text" name="housenumber" /><br /> <label for="postcode">Postcode: </label> <input id="postcode" type="text" name="postcode" /><br /> <label for="email">Email: </label> <input id="email" type="text" name="email" /><br /> <label for="notes">Notes: </label> <input id="notes" type="text" name="notes" /><br /><!-- Here I have taken all the inputs from the form that are required to be sent --><!-- and given the input_id names as the values required by the pay point servers --> <input name="callback" value="http://www.sol.co.uk/authorised;http://www.sol.co.uk/declined" type="hidden" /> <input name="merchant" value="<?php echo "$merhcant"; ?>" type="hidden" /> <!--here I am populating hidden fields with php script data--> <input name="remotepassword" value="<?php echo "$remotepassword"; ?>" type="hidden" /> <input name="req_cv2" value="true" type="hidden" /> <input name="options" value="test_status=true" type="hidden" /> <input name="digest" value="<?php echo "$digest"; ?>" type="hidden" /> <!-- Here I have defined all of the constant hidden values that never change --> <!-- Now in this section of the form I have defined the value that will change, combining the three fields --> <!-- that are required in order to create the digest value --> <input value="Send" type="submit" /> <input type="reset" /> </p></form> Thanks for looking, I think its something basic im missing, first time doing this if you hadnt of guessed Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 20, 2010 Share Posted September 20, 2010 Perhaps you could explain the actual problem you are having? It looks like the first form is receiving data via POST and you are using it to create variables - but you aren't doing anything with the data. But, there is a form created on that page. I *guess* that the form on the first page is POSTING to form 2. Form 2 is apparently checking for GET data, but no GET values were defined/set in the previous form. Try taking the values in FORM 1 and setting them as hidden fields as you did in form 2. Then those values will be available on form 2 from the POST values. Quote Link to comment Share on other sites More sharing options...
crooksey Posted September 20, 2010 Author Share Posted September 20, 2010 What I am trying to do in form 1 is.. $digest = md5($digest_this); //generate the md5 hash$amount = $_POST['amount']; //what I think I am doing here is posting the data so it can be retrived $trans_id = $_POST['trans_id']; //by a get request on from 2, this is where I need help$merchant = $_POST['merhcant'];$remotepassword = $_POST['remotepassword'];[code]I need to work out how to send this data to form two, thats all So the data thats stored insinde these variables can then be passed to another website Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 20, 2010 Share Posted September 20, 2010 As I already stated. In the form 1 script all you are doing is creating variables which are not used on that page. As soon as that script completes execution those variables are lost. You should create hidden fields in form 1 with those values so they will be sent to form 2. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.