I am currently using this code to POST a form's data to https://www.esendex.com/secure/messenger/formpost/SendSMS.aspx:
<script type="text/javascript">
$(document).ready(function(){
$("#textnextofkin").validate({
debug: false,
rules: {
name: "required",
email: {
required: true,
email: true
}
},
messages: {
name: "Please let us know who you are.",
email: "",
},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('http://www.example.co.uk/erc/process2.php', $("#textnextofkin").serialize(), function(data) {
$('#results').html(data);
});
}
});
});
</script>
<form name="textnextofkin" id="textnextofkin" method="POST" action="">
<div class="hiddenfields">
<p>Username:<br>
<input name="EsendexUsername" type="text" value="AAAAA"></p>
<p>Password:<br>
<input name="EsendexPassword" type="password" value="AAAAA"></p>
<p>Account:<br>
<input name="EsendexAccount" type="text" value="AAAAA"></p>
<p>Send Name<br>
<input name="EsendexOriginator" type="text" value="example"></p>
<p>Recipient:<br>
<input name="EsendexRecipient" type="text" value="01234123456"></p>
<p>Message:<br>
<input name="EsendexBody" rows="3" cols="20" value="Hello test message"></p></div>
<input type="submit" class="email-buttons" name="submit" value="Text next of kin">
</form>
process2.php:
<?php
// Initialise CURL
$curl_handle = curl_init();
$data ="EsendexUsername=AAAAA&EsendexPassword=AAAAA&EsendexAccount=AAAAA&EsendexRecipient=01234123456&EsendexBody=test";
$url = "https://www.esendex.com/secure/messenger/formpost/SendSMS.aspx";
curl_setopt ($curl_handle, CURLOPT_URL,$url);
curl_setopt ($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl_handle, CURLOPT_POSTFIELDS, $data);
$result = curl_exec ($curl_handle);
curl_close ($curl_handle);
?>
I need to alter this so that I can POST the form data to process.php instead, and then use process.php to send the information to the Esendex website. I need to do this because process.php contains data I need to include in the form (e.g. $_SESSION['first_name'] ). I suppose I will need to change the Esendex URL above to process.php, but then I don't know what to enter into the process.php page to send the information it recieves.
Could someone please help me to do this?
Thanks for any help