1

I'm getting an error:

Warning: include(friday_set.php?x=First+Set&y=2): failed to open stream: No such file or directory in...

When I go to my url -> "friday_set.php?x=First+Set&y=2" everything comes out how it should

I understand the main reason is that I'm not properly encoding the url and the url can't quantify the & in the string

My code is this (which is similar to what is described in the php manual ):

<?php
 $sel_name = 'First Set';
 $admin_id = '2';

   $query_string = 'x=' . urlencode($sel_name) . "&y=" . urlencode($admin_id);
   include ("friday_set.php?" . htmlentities($query_string));
?>

I can't seem to spot the problem...anyone have a solution??

1
  • @Dagon - Thanks, but I don't see any information in that post that relates to my issue. Commented Dec 8, 2014 at 22:13

1 Answer 1

1

instead of parsing the vars in the file url i suggest this:

<?php
 $sel_name = 'First Set';
 $admin_id = '2';

   include ("friday_set.php");
?>

inside friday_set.php check for either $_GET[x] for direct url or $sel_name for include.

if(isset($_GET['x'])){
$sel_name=$_GET['x'];
}//else $sel_name  is just $sel_name unless you want to check its populated also
Sign up to request clarification or add additional context in comments.

1 Comment

Lol...This is what I get when I try to over-complicate things. Thanks! Works great! I'll accept when it lets me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.