Unable to retrieve data using POST

  • hilltopkennels
    Asked on January 2, 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

  • Welvin Support Team Lead
    Replied on January 2, 2016 at 5:48 PM

    You have to enclose the field names using an apostrophe.

    ['amountTo']

    ['BookingRef']

    Please change and that should fix the problem.

  • hilltopkennels
    Replied on January 6, 2016 at 7:52 AM

    All fixed, thanks

  • Welvin Support Team Lead
    Replied on January 6, 2016 at 9:11 AM

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