Passing datas from the first form to the second then to another pages script

Home Forums Quform PHP Passing datas from the first form to the second then to another pages script

This topic is: not resolved
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #24888
    Norbert
    Participant

    Hi Ally,

    i have a sepcific task to achive here i write down all the details.

    I have to do a form for a foundation for sic children to be able to send donation using your form and passing at the end to an URL all the needed datas. (i have been trying with your wordpress module before and you helped me aswell but then they told me to use different solution)

    I have made a form with input fields using your form with the following names:

    – p24_client – name input
    – p24_email – e-mail input
    – p24_city – text input
    – p24_address – text input
    – p24_zip – text input
    – pay_amount – number input
    – result – number input (pay_amount multiplied with 100)

    for example i write 10 in pay_amount the if i click on checkbox then thevalue of “result” input field will be 1000. this 1000 shoudl be passed to the second form.

    here is the code how i did it:

    scrpit for multiplying with 100

    
    <script>
                
                function calc()
                {
                    var n1 = parseFloat(document.getElementById('pay_amount').value);
                    var n2 = 100;
                    
                        document.getElementById('result').value = n1*n2;
                    
                }
                
    </script>
    

    I made the form following your documentation. but then i had the problem that in form action the process.php shoudl be to be able to validate the input fields and use the functionality of your form.

    i would like to post the datas to a second page where all the datas are shown in a table for example then from the second page redirect the user with all the datas to another page script.

    Here i insert what datas are important to be transferred:

    in the second page/form the follwing code used.

    These datas are for a test account. the php part is at the top of the index.html. All these variables and other submitted dtatas from the form should be transferred to the new page.

    
    <?php
    
    include("p24.php");
    session_start();
    
    $bank = new Przelewy24Class(56177, 56177, '6ac3d9d157d63472', false); 
    
    session_regenerate_id();
    
    $p24_session_id = md5(session_id().date("YmdHis"));
    $p24_merchant_id = 56177;
    $p24_amount = $_POST['result'];
    $p24_currency = 'HUF';
    $CRC = '6ac3d9d157d63472';
    $p24_url_status = 'http://egysziv.hu';
    
    $p24_sign = md5($p24_session_id.'|'.$p24_merchant_id.'|'.$p24_amount.'|'.$p24_currency.'|'.$CRC);
    ?>
    

    $p24_amount = $_POST[‘result’]; – i was trying to add the results value to the $p24_amount variable. then for testing adding a new form and an input and showing the value in the input.

    here is the code for that:

    
    <form  action="https://secure.p24payments.com/trnDirect" method="post" class="quform" accept-charset="UTF-8">
    		session id:	<input type="text" name="p24_session_id" value="" /><br>
    		merch id:	        <input type="text" name="p24_merchant_id" value="" /><br>
    		posid:		<input type="text" ID="#1" name="p24_pos_id" value="" /><br>
    		amount:		<input type="text" id="pay_amount" name="p24_amount_first" value=""/><br>
    		final amount:   <input type="text" name="p24_amount" value="<?=$p24_amount?>"/><br>
    		currency:	        <input type="text" name="p24_currency" value="HUF" /><br>
    		description:     <input type="text" name="p24_description" value="formos fizetés" /><br>
    		client:		<input type="text" name="p24_client" value="<?$_POST['p24_client'];?>" /><br>
    		language: 	<input type="text" name="p24_language" value="hu" /><br>
    		sign:		<input type="text" name="p24_sign" value="<?=$p24_sign?>" /><br>
    		url status:	<input type="text" name="p24_url_status" value="<?=$p24_url_status?>" /><br>
    		url return:	        <input type="text" name="p24_url_return" value="<?=$p24_url_status?>" /><br>
    		email:		<input type="text" name="p24_email" value="<?$_POST['p24_email'];?>" /><br>
    		api ver:	        <input type="text" name="p24_api_version" value="3.2" /><br>
    		encoding:	<input type="text" name="p24_encoding" value="UTF-8" /><br>
    		
    		                       <input type="submit" value="küldés" name="paynow">
    	</form>  
    

    action=”https://secure.p24payments.com/trnDirect&#8221; this is the URL where i should pass all the datas. when clickin submit button.

    I would like to pass all datas from the first form to the second form and at the second page add aditional input fields as hidden with some more required values/variables.
    but at the same time i want to keep the validation what i created for all the input fields using your guide.

    Right now i have tried a lot of things without success.

    I would really appriciate your help!

    So basically i would like to have 2 forms and from the first fomr i would like to pass the datas to the second with the multiplied amount and at the same time use validation.
    then a the second page show th informations for the user what he added before in the first form the use the redirect
    to action=”https://secure.p24payments.com/trnDirect&#8221; passing all the datas.

    and at the end user will be redirected to bank card payment page to be able to donate.

    I hope i was clear enough, but please let me know if you need more information.

    Thanks a lot

    regards,
    Norbert

    passing

    • This topic was modified 6 years, 7 months ago by Norbert.
    • This topic was modified 6 years, 7 months ago by Norbert.
    #24897
    Norbert
    Participant

    Hi Ally,

    So in more simple exmplanation what i would like to achive is:

    i have one form in for eample form.html – i would like to use the process.php in action but laso after form submit redirect the user and pass all datas to the second page/form.

    for example to form2.php , but here in this form the user cannot change any data just check what he/she submitted then again click on a submit button which takes him/her to a new sites script where the datas are trnasferred,

    thank you!

    #24898
    Norbert
    Participant

    HI Ally,

    i have been reading your documentation but didnt find any solution for this issue:

    on more clear way i write it down (sorry for multiply posts 🙂 but maybe this explanation will be the most
    detailed what i would like to achive.

    – I have form1 on a page php/html where people add the following datas:
    – name
    – email
    – city
    – address
    – zip code
    – payment amount

    What i do on this page is i created a script to multiply the “payment_amount” with 100 when the user checks the checkbox in the form adding onclick action and using the function.

    The form action is the process.php as i followed your documentation. So the form is getting validated perfectly.

    But what i would like to do when the user clicks the submit button is to redirect him/her to the second page on the webpage fo example form2.php

    Here at form 2 php i would like to just show the submitted datas to the user before he again press the submit buton on form2.php to redirect him the other website’s script.

    the form2.php should contain these code at the top:

    
    <?php
    
    include("p24.php");
    session_start();
    
    $bank = new Przelewy24Class(56177, 56177, '6ac3d9d157d63472', false); 
    
    session_regenerate_id();
    
    $p24_session_id = md5(session_id().date("YmdHis"));
    $p24_merchant_id = 56177;
    
    $p24_amount = $_POST['result'];
    $p24_currency = 'HUF';
    $CRC = '6ac3d9d157d63472';
    $p24_url_status = 'webpage URL';
    
    $p24_sign = md5($p24_session_id.'|'.$p24_merchant_id.'|'.$p24_amount.'|'.$p24_currency.'|'.$CRC);
    ?>
    

    From the form2.php i still have to transfer the datas to the script/other page

    so there i create a form again where i put hidden fields with some datas that the user dont have to see and inout fields where i show the datas from form1.php for the user,

    here is an example what is not needed for the user to see:

    
    session id:<input type="text" name="p24_session_id" value="<?=$p24_session_id?>" /><br>
    

    i hope i was clear enough.

    Thanks a lot for your support!

    regards,
    Norbert

    • This reply was modified 6 years, 7 months ago by Norbert.
    #24921
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24929
    Norbert
    Participant

    Hi Ally thanks for the reply!

    And shoud i do the same with all the field datas that i need to pass like this:

    $_SESSION['p24_amount'] = $p24_amount;

    or

    $_SESSION['p24_city'] = $p24_city;

    Not only need to print session ID but have to print other values like Name, email etc.

    thank you.!

    #24930
    Norbert
    Participant

    I mean if i paste that code in the custom section, then the session will have these datas like: (if i paste session start in top of form2.php)

    – $bank
    – $merchant_id
    – and the posted datas from form 1 (name/email/ciy etc.)
    – etc.

    So in form 2 i just have to print the variables?

    thank you

    #24975
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24990
    Norbert
    Participant

    Hi Ally,

    Yes it worked thank you!

    alotough i have another question i have made a database and would like to store the submit fields data in the database after form submit.

    But i would liek to store it on second page when i press submit.

    I used your process.php where i pasted the codes you suggested in the custom code section then i redirect the user to “form2.php” page where i echo the datas he submitted in a table and theres the form with hidden inputs and a submit button.

    the second form redirects the user with the submitted datas to another page.

    the form action is: https://secure.p24payments.com/trnDirect

    So whyi would liek to store the datas after the second form submit is because if the user filled out hes name forexample wrong then he can go back and submit the datas again.

    Could you please help me in this then im done with it.

    i have the datas for the mysql database:

    Database: DATABASE_NAME
    Username: USERNAME
    Password: PASSWORD

    thank you very much!

    Norbert

    #25000
    Norbert
    Participant

    Hi Ally

    Please dont take into account my last post. This one is more detailed. Thank you.

    Using your documentation about adding form datas to database works perfectly only one thing i dont understand.

    i have 7 input fields: the input fields name is equal to the database table column names what i have created in phpMyAdmin.

    – p24_session_id
    – p24_email
    – p24_client
    – p24_city
    – p24_address
    – p24_zip
    – p24_amount

    Every datas appear in the database table/volumns on form submit, but the session ID not showing up.

    The session variable looks like this in the custom code section in the process.php :

    $p24_session_id = md5(session_id().date("YmdHis"));

    The full code block containing the following codes:

    
                    session_start();
    		include("p24.php");
    		
    		$bank = new Przelewy24Class(56177, 56177, '6ac3d9d157d63472', false); 
    
    		session_regenerate_id();
    
    		$p24_session_id = md5(session_id().date("YmdHis"));
    		$p24_merchant_id = 56177;
    		$p24_amount = $_POST['result'];
    		$p24_currency = 'HUF';
    		$CRC = '6ac3d9d157d63472';
    		$p24_url_status = "https://www.egysziv.hu/adomanyozas/sikeres-tranzakcio/";
    		$pay_amount = $_POST['pay_amount'];
    		$p24_client = $_POST['p24_client'];
    		$p24_city = $_POST['p24_city'];
    		$p24_address = $_POST['p24_address'];
    		$p24_zip = $_POST['p24_zip'];
    		
    
    		$p24_sign = md5($p24_session_id.'|'.$p24_merchant_id.'|'.$p24_amount.'|'.$p24_currency.'|'.$CRC);
    
    		$_SESSION['p24_session_id'] = $p24_session_id;
    		$_SESSION['p24_sign'] = $p24_sign;
    		$_SESSION['p24_merchant_id'] = $p24_merchant_id;
    		$_SESSION['p24_client'] = $p24_client;
    		$_SESSION['p24_amount'] = $p24_amount;
    		$_SESSION['p24_sign'] = $p24_sign;
    		$_SESSION['p24_email'] = $_POST['p24_email'];
    		$_SESSION['p24_city'] = $p24_city;
    		$_SESSION['p24_address'] = $p24_address;
    		$_SESSION['p24_zip'] = $p24_zip;
    		$_SESSION['pay_amount'] = $pay_amount;
    		$_SESSION['p24_url_status'] = $p24_url_status;
    

    After pressing the submit button on the first page the process.php code runs. At this time the input field datas are getting in the database columns, only the session ID is not shown in the column, its empty.

    I have been trying some things like changing the data type of column (VARCHAR etc.). Maybe the lenght is not enough?

    A generated session ID looks like this for example: 08f9b7194dc40773f47e27481de05f01

    What column data type and leght should i use for this?

    Since i designed the 2 page to behave like:
    – You are the user who want to use the form.
    – you write in all the datas in the input field then you press the submit button and get to the second page
    – Here you see a review about you submitted data
    – You have the possibility to go back to the first page if you wrote some datas incorrectly
    – When you use the back button the form datas get reseted by code
    – the after input data correction you go to the second page again
    – on the second page if youpress the other form submit button, you get redirected to an outside page passing all the datas

    My question is how is it possible to upload the input field datas to the database not after the first form what uses the processs.php in action but after the second what uses the action: https://secure.p24payments.com/trnDirect

    Thanks a lot for your awesome support!

    Best Regards,
    Norbert

    #25021
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy