一个欢乐的夜晚!
我的任务:用户转到使用 Yandex 货币付款的页面。该站点必须将数据写入客户在表格中输入的数据库,并使用他输入的参数将他重定向到 Yandex Money 网站。如果我完成了第一个任务,那么我不知道如何进一步发送用户。它应该采用以下形式:
<form method="POST" action="https://money.yandex.ru/quickpay/confirm.xml">
<input type="hidden" name="receiver" value="410013229143888">
<input type="hidden" name="formcomment" value="Оплата через AIVA">
<input type="hidden" name="quickpay-form" value="shop">
<input type="hidden" name="targets" value="Оплата по счету">
<input type="hidden" name="need-fio" value="false">
<input type="hidden" name="need-email" value="false">
<input type="hidden" name="need-phone" value="false">
<input type="hidden" name="need-address" value="false">
<input type="hidden" name="paymentType" value="PC">
<input type="email" name="short-dest" class="form-control" id="exampleInputEmail1" placeholder="mail@mail.ru">
<input type="text" id="comment" name="comment" class="form-control" id="exampleInputEmail1" placeholder="Необязательное поле">
<input type="text" name="sum" class="form-control" id="exampleInputEmail1" value="200">
<button type="submit" class="btn btn-primary">ок</button>
</form>
查看文件
<?php echo form_open(site_url("payment/add_card_yandex_pro/"), array("" => "")) ?>
<input type="email" name="short-dest" class="form-control" id="exampleInputEmail1" placeholder="mail@mail.ru">
<input type="text" id="comment" name="comment" class="form-control" id="exampleInputEmail1" placeholder="Необязательное поле">
<input type="text" name="sum" class="form-control" id="exampleInputEmail1" value="200">
<button type="submit" class="btn btn-primary">ок</button>
<?php echo form_close() ?>
控制器文件
public function add_card_yandex_pro()
{
// Сохранение действия в истории операций
$pay_method = "Банковские карты Яндекс";
$transaction = $this->common->nohtml($this->input->post("targets"));
$name = $this->common->nohtml($this->input->post("formcomment"));
$amount = $this->common->nohtml($this->input->post("sum"));
$email = $this->common->nohtml($this->input->post("short-dest"));
$comment = $this->common->nohtml($this->input->post("comment"));
if(empty($name)) {
$this->template->error(lang("error_79"));
}
$historyid = $this->payment_model->add_card_yandex(array(
"pay_method" => $pay_method,
"transaction" => $transaction,
"name" => $name,
"amount" => $amount,
"email" => $email,
"comment" => $comment,
"timestamp" => time()
)
);
$this->session->set_flashdata("globalmsg", lang("success_40"));
redirect(site_url("pay_link"));
}
如何在控制器中正确编写表单?很高兴并感谢任何帮助或指导。
在数据库中记录信息后,您需要收集信息发送给 Yandex
在这里你只是重定向到链接
redirect($url)