1

I am using Codeigniter in My website and it works very well in all browsers in windows or phones except in snapchat.

When I am trying to submit the form I get the message:

message undefined index 'clientname'
message undefined index 'clientmessage'

<form action="<?php echo base_url(); ?>R/H/212F32" method="POST">

  <input type="text" name="clientname" placeholder="name">

  <textarea rows="5" name="clientmessage" placeholder="message"></textarea>

  <input type="submit" value="send" />

</form>

I tried using an extra button with javascript to popup message alert of clientname and clientmessage content but nothing happens so I guess that there is something that happening in snapchat browser ?

Edited : Controller 'T' That display the form

<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class T extends MY_Controller {

    public function __construct(){
        parent::__construct();
    }

    function _remap($param) {
        $this->index($param);
    }

    public function index($param)
    {
        $data = array();
        $this->load->view('Head');
        $data['code'] = $param;
        $this->load->view('NewForm' , $data);
        $this->load->view('Foot');
    }

}

Controller 'R' That recive the form submited

<?php

class R extends MY_Controller {

    public function H($c){
                $this->load->view('Head');
                $text = $_POST['clientname'];
                $message = $_POST['clientmessage'];
                //$this->input->post wont work also
                // $this->input->post('clientname');
                // $this->input->post('clientmessage');
                $this->load->view('Foot');
    }
}

UPDATED 10/05/2019 : I tried to do basic form submit like this :

index.html

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Snapchat issue !</title>
  <meta name="description" content="">
  <meta name="author" content="">
</head>
<body>
        <form action="./Test.php" method = "post">
            First name:<br>
            <input type="text" name="firstname" value="Turki">
            <br>
            Last name:<br>
            <input type="text" name="lastname" value="Test123">
            <br><br>
            <input type="submit" value="Submit">
          </form> 
</body>
</html>

Test.php

<?php

var_dump($_POST);

?>

The result :

in Android:

array(2) { ["firstname"]=> string(5) "Turki" ["lastname"]=> string(7) "Test123" }

in IOS:

array(0) {}

same thing happen without codeigniter so I rolled it out , but I noticed the following : 1 - it work fine in Snapchat in Android , but the issue appear in IOS only 2- in IOS if the link was send using snapchat chat it will work fine too even in IOS , but if it was linked in Story the issue appear !!!!

Turki
  • 19
  • 2
  • it would be important to show the code that generates those errors. namely the controller/model – Alex May 08 '19 at 20:26
  • since update: well you don't have any validation so it makes sense that if the user submits a blank form you'll receive that error. this should occur in all browsers not just a specific one as it is platform agnostic behavior of php – Alex May 09 '19 at 00:00
  • I tried all kinds of inputs my self including empty ones , alphas , numerical , same error message, strange issue – Turki May 09 '19 at 00:33
  • `$this->input->post('clientname');` shouldn't give the above error however. if `clientname` is not set, it will simply return null. doesn't necessarily help your issue. – Alex May 09 '19 at 01:42
  • can you `var_dump($_POST);` for us? It seems the POST is not getting through and thus causing the error. Like @Alex said above using the CI method (`$this->input->post('fieldname')`) should at least prevent the error, but you need to focus on why are those elements not being posted – Javier Larroulet May 09 '19 at 21:57
  • I updated the question , check it out please – Turki May 10 '19 at 14:23

0 Answers0