PHP GET variable from another page -


i have following lines:

if(isset($_get['search'])){   $search_query = $_get['user_query']; 

the problem not trying retrieve variable page, rather searchpage.php, different page located within same folder. user_query variable page instead. instance, in page have:

searchpage.php?user_query=microsoft&search=search 

if need clarification, let me know.

seems weird if must whats wrong redirecting searchpage.php page want parameter eg

in searchpage.php

 header("location:the_other_script.php?user_query=".$_get['search']); 

and in the_other_script.php

 if(isset($_get['user_query']){     $user_query = $_get['user_query'];  } 

begs question why not logic in searchpage.php? if want separate code out use function call in searchpage.php.

edit:

so have script file called functions.php.. in case require file in searchpage.php like..

require_once('the/path/to/functions.php'); 

and in searchpage.php

 if(isset($_get['user_query']){     $returned_from_function = a_function_from_your_functions($_get['user_query']);     //do stuff  }  //do other stuff 

in functions.php

 function a_function_from_your_functions($user_query){    //do need    return $something; //optionally    } 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -