What is the equivalence of:
<form action="https://paypaad.bankpasargad.com/PaymentController" method="POST">
<input type="hidden" name="content" value='<?php echo $xml ?>' />
<input type="hidden" name="sign" value="<?php echo $sign ?>" />
<input type="submit" value="send" name="submit" />
</form>
in Drupal 7 ?
I already use following code in my form submit handler, but it doesn't work:
function Chargingform_nameform_submit($form, &$form_state)
{
$options = array();
$options = array(
'method' => 'POST',
'xml' => $form_state['values']['xml'],
'sign' => $form_state['values']['sign'],
'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
);
$url = 'https://paypaad.bankpasargad.com/PaymentController';
$response = drupal_http_request($url, $options);
}
How I can submit XML, sign to URL and redirect user to that URL at the same time?
This is my code:
function Chargingform_nameform() {
$xml = 'PHP Handbook30000130000This is good book.MySQL Handbook25000250000This is a good book too.';
// Get sing
$sign ='ewtnXYRWPSalHhna9hgO+Kc0W9Z8JBUeG1FkcKPvZL5w2s588c0/B9r';
$form['xml'] = array(
'#title' => t('xml'),
'#type' =>'hidden',
'#value'=>$xml,
);
$form['sign'] = array(
'#title' => t('sign'),
'#type' =>'hidden',
'#value'=>$sign,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('submit'),
);
return $form;
}
function Chargingform_nameform_submit($form, &$form_state) {
$options = array();
$options = array(
'method' => 'POST',
'xml' => $form_state['values']['xml'],
'sign' => $form_state['values']['sign'],
);
$url = 'https//:url';
$response = drupal_http_request($url, $options);
}
I don't know really how to manage it in JavaScript.
Any suggestions?