我需要将用户输入的两个变量传输到表单中,但我需要将所有数据一起发送到数据库。我无法使用$this->input->post
或$_REQUEST
,我需要创建www.xxx.com/controler?var1=xx*&var2=xx
之类的链接。
这是我的代码:
<?php if($this->input->get_post('tip', TRUE) =='3') {?>
<input type="hidden" name="var_plati" id="var_plati" value="https://www.example.com/beta/tesst/credit-card-reservation-form?tour=<?php echo $_REQUEST['tour'] ?>&tip=<?php echo $_REQUEST['tip'];?>&c=<?php echo $this->input->post("var_charter"); ?>&ad=<?php echo THIS I NEED?>&dep=<?php echo $_REQUEST['var_dep'] ?>" >
答案 0 :(得分:0)
方法1:您可以将变量用作href链接 例如:
<a href="approve.php?id=<?php echo $sub->id ?>" role="button" class="btn">Add Topic</a>
方法2:使用ajax调用将代码发送到codeigniter控制器
var string_array="&tour="+<?php echo $_REQUEST['var1'] ?>+"&tip="+<?php echo $_REQUEST['var2'] ?>+"&c="
+<?php echo $this->input->post("var_charter"); ?>+"&ad="+<?php echo 'THIS I NEED'?>+"&address="+address+"&short_address="+short_address
+"&dep="+<?php echo $_REQUEST['var_dep'] ?>;
$.ajax({
type: "POST",
url: "<?php echo site_url('https://www.example.com/beta/learning/reservation-form');?>",
data:string_array,
success: function(msg) {
console.log(msg);
}
});
}