I have created a page template with a form like this

<form id="form_52393" class="appnitro" action="../application.php" 
<div class="form_description">
<h2>Finance Application Form</h2>
Enter the course name, its price, the term of you finance and your 
deposit. You will then be reidrected to an online application form to 
complete the process.

    <li><label class="description" for="action">action</label>
<div><input id="element_9" class="element text medium" 
maxlength="255" name="action" type="hidden" 
value="credit_application_link" /></div></li>
    <li id="li_5"><label class="description" 
for="Identification[api_key]">Identification[api_key] </label>
<div><input id="element_5" class="element text medium" 
maxlength="255" name="Identification[api_key]" type="hidden" 
value="be803c55eeaf79c89b6ff46ac6a9a039" /></div></li>
<li id="li_6"><label class="description" 
<div><input id="element_6" class="element text medium" 
maxlength="255" name="Identification[InstallationID]" type="hidden" 
value="13161" /></div></li>
    <li><label class="description" 
<div><input id="element_7" class="element text medium" 
maxlength="255" name="Identification[RetailerUniqueRef]" 
type="hidden" value="test999" /></div></li>
<li id="li_1"><label class="description" 
for="Goods[Description]">Course Name </label>
<div><input id="element_1" class="element text medium" 
maxlength="255" name="Goods[Description]" type="text" value="" />
    <li id="li_10"><label class="description" 
for="Goods[Price]">Price </label>
<span class="symbol">£</span><input id="element_12_1" class="element 
text currency" name="Goods[Price]" size="10" type="text" value="" /> 
<label for="element_12_1">Pounds</label></li>
    <li id="li_4"><label class="description" 
for="Finance[Code]">Finance Type </label>
<div><select id="element_4" class="element select medium" 
<option selected="selected" value=""></option>
<option value="ONIF6">Interest Free Credit (0% APR) 6 month 
<option value="ONIF9">Interest Free Credit (0% APR) 9 month 
<option value="ONIF10">Interest Free Credit (0% APR) 10 month 
<option value="ONIF12">Interest Free Credit (0% APR) 12 month 
<option value="ONIF18">Interest Free Credit (0% APR) 18 month 
<option value="ONIF24">Interest Free Credit (0% APR) 24 month 
<option value="ONIF36">Interest Free Credit (0% APR) 36 month 
<option value="ONIB12-12.9">Low Rate Credit (12.9% APR) 12 month 
<option value="ONIB18-12.9">Low Rate Credit (12.9% APR) 18 month 
<option value="ONIB24-12.9">Low Rate Credit (12.9% APR) 24 month 
<option value="ONIB36-12.9">Low Rate Credit (12.9% APR) 36 month 
<option value="ONIB12-24.9">Classic Credit (24.9(% APR) 12 month 
<option value="ONIB18-24.9">Classic Credit (24.9(% APR) 18 month 
<option value="ONIB24-24.9">Classic Credit (24.9(% APR) 24 month 
<option value="ONIB36-24.9">Classic Credit (24.9(% APR) 36 month 
    <li id="li_12"><label class="description" 
for="Finance[Deposit]">Price </label>
<span class="symbol">£</span><input id="element_12_1" class="element 
text currency" name="Finance[Deposit]" size="10" type="text" value="" 
/> .
<label for="element_12_1">Pounds</label></li>
    <li class="buttons"><input name="form_id" type="hidden" 
value="52393" /><input id="saveForm" class="button_text" 
name="submit" type="submit" value="Submit" /></li>

Which on submit should post data and trigger this php script

$interface = "https://test.dekopay.com:3343/";
    $postFields = Array(
    "action" => "credit_application_link",
    "Identification[api_key]" => "be803c55eeaf79c89b6ff46ac6a9a039",
    "Identification[InstallationID]" => "13161",
    "Identification[RetailerUniqueRef]" => uniqid(),
    "Goods[Description]" => "",
    "Goods[Price]" => "",
    "Finance[Code]" => "",
    "Finance[Deposit]" => "",

function httpPost($interface, $postFields)
    $curlSession = curl_init();
    curl_setopt($curlSession, CURLOPT_URL, $interface);
    curl_setopt($curlSession, CURLOPT_HEADER, 0);
    curl_setopt($curlSession, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($curlSession, CURLOPT_POST, 1);
    curl_setopt($curlSession, CURLOPT_POSTFIELDS, $postFields);
    curl_setopt($curlSession, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curlSession, CURLOPT_TIMEOUT, 180);
    curl_setopt($curlSession, CURLOPT_FOLLOWLOCATION, 1);
    return $curl_response = curl_exec($curlSession);
header('Location: ' . httpPost($interface, $postFields),True);

Which should check the submitted data then redirect to a third party generated url.

Instead I am receiving either "page not found" or a plain white page. THe template file and php file are in the same child theme folder.

Thanks in advance for any help.

  • Does your application.php really sit in the parent directory (from the client's point of view)?
    – janh
    Commented Oct 20, 2017 at 11:02
  • I assume you get your posted values further up the script? But as @janh2 has already stated - are you sure 'application.php' is two directories up from where the form is located? It looks as if application.php is located in the wp-content folder?
    – ProEvilz
    Commented Oct 20, 2017 at 11:16
  • Currently, application.php and the form template sit in this directory /wp-content/themes/medipro-sub/
    – gentyspun
    Commented Oct 20, 2017 at 11:19
  • Then you should let your form action reflect that: action="/wp-content/themes/medipro-sub/application.php". Does it work with that change?
    – janh
    Commented Oct 20, 2017 at 11:24
  • I'm assuming you mean action="/wp-content/themes/medipro-sub/deko_app.php" as that's the php file which should be triggered? When I change that I get a plain white page with the following in the address bar "example.co.uk/wp-content/themes/medipro-sub/deko_app.php"
    – gentyspun
    Commented Oct 20, 2017 at 11:29


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.