如何在 codeigniter 中 运行 带有参数的表单?
how to run a form with parameter in codeigniter?
我是 codeigniter 的新手,我想 运行 在用户输入号码时查看我的短信网络服务代码。
但是 post 方法是空的!谁能帮帮我?
var_dump($_POST['sendSms']);exit;
if(array_key_exists('sendSms', $_POST)) {
sendSms();
}
function sendSms(){ //my sms web service code}
echo '<form method="Post" action= "http://crm.oynarco.ir/admin/settings?group=sms">';
?>
<input type="hidden"
name="<?php echo $this->security->get_csrf_token_name()?>"
value="<?php echo $this->security->get_csrf_hash()?>">
<?php
echo '<input type="hidden" name="username" value="09172030433"/><br />';
echo '<input type="hidden" name="password" value="Oynar1234" /><br />';
echo '<input type="text" name="to" class="form-control test-phone" placeholder="'._l('staff_add_edit_phonenumber').'" /><br />';
echo '<textarea type="text" name="text" class="form-control sms-gateway-test-message" placeholder="'._l('test_sms_message').'" ></textarea><br />';
echo '<input type="text" name="From" class="form-control" value="5000203069627" /><br />';
echo '<input type ="submit" name="sendSms" class="btn btn-info send-test-sms" value="'._l('send_test_sms').'" />';
echo '</form>';
在控制器的 action root 中,然后在控制器中获取 post 方法并添加您的短信功能。
?>
<form method="Post" action= "settings/sendSms">
<input type="hidden"
name="<?php echo $this->security->get_csrf_token_name()?>"
value="<?php echo $this->security->get_csrf_hash()?>">
<?php
echo '<input type="hidden" name="username" value = "09172030433"/><br />';
echo '<input type="hidden" name="password" value ="Oynar1234" /><br />';
echo '<input type="text" name="to" class="form-control test-phone" placeholder="'._l('staff_add_edit_phonenumber').'" /><br />';
echo '<textarea type="text" name="text" class="form-control sms-gateway-test-message" placeholder="'._l('test_sms_message').'" ></textarea><br />';
echo '<input type="text" name="From" class="form-control" value = "5000203069627" /><br />';
echo '<input type ="submit" name="sendSms" class="btn btn-info send-test-sms" value = "'._l('send_test_sms').'" />';
echo '</form>';
在控制器中:
public function sendSms(){
//var_dump($_POST);exit;
if (isset($_POST) ){
//send sms
}
我是 codeigniter 的新手,我想 运行 在用户输入号码时查看我的短信网络服务代码。 但是 post 方法是空的!谁能帮帮我?
var_dump($_POST['sendSms']);exit;
if(array_key_exists('sendSms', $_POST)) {
sendSms();
}
function sendSms(){ //my sms web service code}
echo '<form method="Post" action= "http://crm.oynarco.ir/admin/settings?group=sms">';
?>
<input type="hidden"
name="<?php echo $this->security->get_csrf_token_name()?>"
value="<?php echo $this->security->get_csrf_hash()?>">
<?php
echo '<input type="hidden" name="username" value="09172030433"/><br />';
echo '<input type="hidden" name="password" value="Oynar1234" /><br />';
echo '<input type="text" name="to" class="form-control test-phone" placeholder="'._l('staff_add_edit_phonenumber').'" /><br />';
echo '<textarea type="text" name="text" class="form-control sms-gateway-test-message" placeholder="'._l('test_sms_message').'" ></textarea><br />';
echo '<input type="text" name="From" class="form-control" value="5000203069627" /><br />';
echo '<input type ="submit" name="sendSms" class="btn btn-info send-test-sms" value="'._l('send_test_sms').'" />';
echo '</form>';
在控制器的 action root 中,然后在控制器中获取 post 方法并添加您的短信功能。
?>
<form method="Post" action= "settings/sendSms">
<input type="hidden"
name="<?php echo $this->security->get_csrf_token_name()?>"
value="<?php echo $this->security->get_csrf_hash()?>">
<?php
echo '<input type="hidden" name="username" value = "09172030433"/><br />';
echo '<input type="hidden" name="password" value ="Oynar1234" /><br />';
echo '<input type="text" name="to" class="form-control test-phone" placeholder="'._l('staff_add_edit_phonenumber').'" /><br />';
echo '<textarea type="text" name="text" class="form-control sms-gateway-test-message" placeholder="'._l('test_sms_message').'" ></textarea><br />';
echo '<input type="text" name="From" class="form-control" value = "5000203069627" /><br />';
echo '<input type ="submit" name="sendSms" class="btn btn-info send-test-sms" value = "'._l('send_test_sms').'" />';
echo '</form>';
在控制器中:
public function sendSms(){
//var_dump($_POST);exit;
if (isset($_POST) ){
//send sms
}