assgar Posted October 17, 2010 Share Posted October 17, 2010 Hello I am experiencing some issues with a function and I cannot identify the problem. The function is not receiving any parameter. The URL values are passed correctly. I used echo to display the parameters outside the function and that worked. I also used echo to display the parameters inside the function and no parameter were displayed. So the function is not receiving parameters. <?php $find = $_REQUEST['u_find']; $field = $_REQUEST['u_field']; $searching = $_REQUEST['u_search']; echo"(1a)$find, (1b)$field, (1c)$searching";//outside function function test_display($searching, $field, $find) { echo"(2a)$find, (2b)$field, (2c)$searching";//inside function } ?> Quote Link to comment https://forums.phpfreaks.com/topic/216094-function-parameter/ Share on other sites More sharing options...
BlueSkyIS Posted October 17, 2010 Share Posted October 17, 2010 you never call the function test_display(), so it will never run. add this after the function definition, an example of calling the function: test_display('hello', 'world', '1234abcd'); Quote Link to comment https://forums.phpfreaks.com/topic/216094-function-parameter/#findComment-1123077 Share on other sites More sharing options...
assgar Posted October 17, 2010 Author Share Posted October 17, 2010 Hello The problem still exists as described. I was trying to keep it simple, below is the function call being used. NOTE: The function is a separate script that is linked to the page using <? include("../display"); //link separate script test_display($searching, $field, $find);//call function ?> Quote Link to comment https://forums.phpfreaks.com/topic/216094-function-parameter/#findComment-1123111 Share on other sites More sharing options...
jcbones Posted October 18, 2010 Share Posted October 18, 2010 So give us the correct script, as guessing will get us no where. Therefore, we will continue to get feedback of "its still not working". Quote Link to comment https://forums.phpfreaks.com/topic/216094-function-parameter/#findComment-1123135 Share on other sites More sharing options...
PFMaBiSmAd Posted October 18, 2010 Share Posted October 18, 2010 It's probably because you are using short open tags <? and you php code is not being seen as php code. Use full opening tags <?php Quote Link to comment https://forums.phpfreaks.com/topic/216094-function-parameter/#findComment-1123165 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.