CodeIgniter Forums
problem with $_GET - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: problem with $_GET (/showthread.php?tid=26449)

Pages: 1 2


problem with $_GET - El Forum - 01-13-2010

[eluser]cris_mashups[/eluser]
Hello everyone!

I need help and explanation about my problem Smile im a newbie to codeigniter.
I have to save some variables from my flash(swf file) then saves it to my database using CI. my problem is that im using $_GET to get the value of textfield of my flash(swf) but it doesn't work on my CI i don't know where my problem is? is that from my flash? or from my CI?


i don't know im stock...

Thanks a lot...


problem with $_GET - El Forum - 01-13-2010

[eluser]cris_mashups[/eluser]
oh i forgot to tell you guys my code works in PHP i can save or GET the value of textfield of my flash...now i have to put or apply that on CI how am i going to do that?no errors but it doesn't save on my database but when im going to type this on my url
ex.
http://localhost/CI/index.php/controller/function/flash?num1=2&num2=2

THIS IS THE OUTPUT Sad
404 Page Not Found
The page you requested was not found.


problem with $_GET - El Forum - 01-14-2010

[eluser]JHackamack[/eluser]
Try changing:
$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

to
$config['enable_query_strings'] = TRUE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

in your application/config/config.php file


problem with $_GET - El Forum - 01-14-2010

[eluser]cris_mashups[/eluser]
Hi Jhackamack,

i already tried that way but still nothing happened. i dont know if my problem is in my flash or in my CI
THIS IS MY CODE FOR ACTIONSCRIPT:

stop();

var insert_lv:LoadVars = new LoadVars();


var filepath:String;


// set the path to the PHP script based on whether this is being tested

// locally or online. If local, use script saved on online webserver.

// Can use http://localhost instead if script is on local webserver.



if (_url.indexOf("http") != 0) filepath = "http://localhost/iserver/c/CI/cd/c_d/index.php/login/c_c/";

else filepath = "../cris/CI/character_designer/c_designer/";



function insertRecord(){


insert_lv.hairconfig = hair_input;

insert_lv.eyeconfig = eyes_input;

msg_ta.text = "Successfully saved!";


insert_lv.sendAndLoad(filepath + "flash", insert_lv, "GET")

}

add_btn.addEventListener("click", insertRecord);



so my controller class is login and function is c_c
then my view named flash


then this is my model:
function update(){
$query = $this->db->get('myTable');
$this->db->where('user_name', $user_name);
$this->db->where('user_pass', $user_pass);
return $query->result();

$id=$name=$this->session->userdata('user_name');

$data = array(
'hair_conf' => $_GET['hairconfig'];,
'eye_conf' => $_GET['eyeconfig'];
);
$this->db->where('id', $id);
$this->db->update('myTable2', $data);

}


problem with $_GET - El Forum - 01-14-2010

[eluser]Cro_Crx[/eluser]
You can use the [code] [/code] tags to wrap your code on these forums. It will format the code so it's easier to read.

Can you browse to the URL http://localhost/CI/index.php/controller/function/flash ????


problem with $_GET - El Forum - 01-14-2010

[eluser]cris_mashups[/eluser]
yes i can browse http://localhost/CI/index.php/controller/function/flash

it displays my swf movie


problem with $_GET - El Forum - 01-14-2010

[eluser]cris_mashups[/eluser]
when im using this one $_GET['eyeconfig'] it returns some error like undefined: eyeconfig

$_GET['eyeconfig'] is from my swf file

eyeconfig is the given name for my textfield in flash.


problem with $_GET - El Forum - 01-14-2010

[eluser]mcr_rm[/eluser]
it is not something as simple as using a trailing slash before sending the params is it? i.e. /flash/?param=1&param=2 etc.

Also can you not use POST?


problem with $_GET - El Forum - 01-14-2010

[eluser]cris_mashups[/eluser]
i already tried that flash/?param=1&param=2

it displays :
404 Page Not Found
The page you requested was not found.

i think i cant use POST because my submit button is inside my flash(swf) movie Sad


problem with $_GET - El Forum - 01-14-2010

[eluser]mcr_rm[/eluser]
Really? We do it here at work all the time. However flash isn't my strong point I just know I set up the system to recieve a POST call and the flash gurus do there magic.

So to be honest there is another way round it. Firstly if your controller is called login and within that controller you have a function c_c()

Not sure what the flash bit is about?

Because Code igniter is supposed to kill $_GET requests I think its a good idea to stay away. You can still however pass values by constructing the url /controller/function/param1/param2

and using $this->uri->segment(3) for param1 and $this->uri->segment(4) for param 2.

Would you be able to modify it that way?

So in my mind your controller is
Code:
class Login extends Controller {

    __construct()
    {
        parent::Controller();
        $this->load->model('Your_model', 'Your');
            
    }

public function index()
{

}

public function flash()
{
/// this shows your flash file?
}

public function c_c()
{
/// this is your form receive address
}

}
?>

I think you have some routing issues so post up your controller and we might be able to dig it out. Smile