note 60229 added to function.require-once

From: Date: Fri, 30 Dec 2005 16:30:18 +0000
Subject: note 60229 added to function.require-once
Groups: php.notes 
Request: Send a blank email to php-notes+get-100995@lists.php.net to get a copy of this message
I'm having a problem passing a string to a file by way of require_once() or include(). In the site this happens on, there is a subnav menu in the left-hand column, and it is displayed with require_once('includes/left.php'). The problem arises when I try to pass a string with a space in it, to the left.php page using require_once. The current malfunctioning code is: require_once('includes/left.php?page=category&value=' . $category); This system works fine when $category doesn't have spaces. But if $category contains any spaces I get the errors: Warning: main(includes/left.php?page=category&value=KBH Series): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in [path]\httpdocs\php\view_cat.php on line 98 and Fatal error: main(): Failed opening required 'includes/left.php?page=category&value=KBH Series' (include_path='.;./includes;./pear') in [path]\httpdocs\php\view_cat.php on line 98 I've tried using cookies, literal quotations, etc to try to get this variable passed to left.php and nothing seems to work. I feel silly explaining this issue, because it's obviously a result of miscommunications between myself and the designer.. but it would be nice to find an easy fix. Ideas anyone? ---- Manual Page -- http://www.php.net/manual/en/function.require-once.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+60229 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+60229&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+60229&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+60229&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+60229&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+60229&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+60229&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+60229&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+60229&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100995) next »