cjosephson Posted February 19, 2008 Share Posted February 19, 2008 Hey all, I'm looking to include a page with variables in the link, e.g. search.php?id=test&name=fun, etc. The include function works for me if I have just the page (search.php), but not with the other variables. A little background on what I'm trying to do. I have a main page with a search that has lots of options. It was getting really bulky to do all the coding on the same page, so I am trying pass the variables from the form into a separate search page, where a search is performed and return the results. I looked at some tutorials, and nothing is really mentioned about what I'm trying to do. Is it possible? If not, does anyone have any suggestions for alternatives? Quote Link to comment Share on other sites More sharing options...
trq Posted February 19, 2008 Share Posted February 19, 2008 The simplest approuch would be to use.... <?php $id = 'foo'; include 'search.php'; ?. This would make $id available within search.php If not, does anyone have any suggestions for alternatives? I would suggest wrapping your search functionality within a class and calling it as required. Quote Link to comment Share on other sites More sharing options...
cjosephson Posted February 21, 2008 Author Share Posted February 21, 2008 Thanks for your reply. I made a simple testing class, which takes one argument, and echoes it back. I made a new page to see if it worked, and it did. When I try and require it in the page I need it in, though, it doesn't work! Why would it work fine in one page, but not in another? (barring typos...) here's what I typed, and put in the third line of the page: require("Search2.php"); Quote Link to comment Share on other sites More sharing options...
cjosephson Posted February 21, 2008 Author Share Posted February 21, 2008 Also, there are no error messages... a blank page just turns up ??? Edit: I copied and pasted all the code to a new page... and it WORKED. What is up with this bizzare issue? I change nothing, but it suddenly works? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 21, 2008 Share Posted February 21, 2008 When learning php, developing php code, or debugging php code, turn on full php error reporting in php.ini, a .htaccess file, or a local php.ini file to get php to help you (otherwise you are just flying blind.) Turning on full php error reporting in your script will not help with fatal parse errors because the code never runs and error reporting won't ever get turned on. Quote Link to comment 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.