Unable to retrieve data using POST

  • Profile Image
    hilltopkennels
    Asked on January 02, 2016 at 11:30 AM

    I've created a custom web page to send my POST data to at http://hilltopkennels.onlinewebshop.net/redirect.php

    The file redirect.php contains the following code (below in italics) which is supposed to retrieve the relevant fields and create a url. (The url is just simply echo'd for debug purposes at present.)

    <?php

     $ans = $_POST;

     $url1 = "?instId=1068892&cartId=WorldPayTest";

     $url2 = "&testMode=100";

     

     $var1 = "&amp;currency=GBP&amount=".urlencode($ans[amountTo]);

     $var2 = "&desc=".urlencode($ans[BookingRef]);

     

     $urldest = $url1.$var1.$var2.$url2;

     

    echo $urldest;

    ?>

     

    Problem I'm having is that although the ThankYou page of the form has "Send POST data" set, the field values amountTo and BookingRef are not being retrieved. Can you let me know what I'm doing wrong?

     

    Thanks

  • Profile Image
    Welvin
    Answered on January 02, 2016 at 05:48 PM

    You have to enclose the field names using an apostrophe.

    ['amountTo']

    ['BookingRef']

    Please change and that should fix the problem.

  • Profile Image
    hilltopkennels
    Answered on January 06, 2016 at 07:52 AM

    All fixed, thanks

  • Profile Image
    Welvin
    Answered on January 06, 2016 at 09:11 AM

    That's great to know. Please contact us again if we can help in any way.