petenaylor Posted August 20, 2010 Share Posted August 20, 2010 Hi all I am writing a code to update customer details. It all works great until I get to the last line of code that directs the user to the next page: include ('profile-success.php'); I need it to be the following page: profile-success.php?username=$username Can anyone show me how to edit the line to include the url variable? I keep getting this error: Warning: include() [function.include]: Failed opening 'profile-success.php?username=$username' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/cndvizp/public_html/prints2impress.co.uk/upload/update-profile.php on line 96 Thanks Pete. Quote Link to comment https://forums.phpfreaks.com/topic/211294-include-url-with-variable/ Share on other sites More sharing options...
hcdarkmage Posted August 20, 2010 Share Posted August 20, 2010 Try: include ('profile-success.php?username='.$username); Of course, I am not sure if you can even add things to an include like that. Quote Link to comment https://forums.phpfreaks.com/topic/211294-include-url-with-variable/#findComment-1101690 Share on other sites More sharing options...
petenaylor Posted August 20, 2010 Author Share Posted August 20, 2010 Hi sorry the file is called update-success.php I now get the error: Warning: include(update-success.php?username=petenaylor) [function.include]: failed to open stream: No such file or directory in /home/cndvizp/public_html/prints2impress.co.uk/upload/update-profile.php on line 94 Warning: include(update-success.php?username=petenaylor) [function.include]: failed to open stream: No such file or directory in /home/cndvizp/public_html/prints2impress.co.uk/upload/update-profile.php on line 94 Warning: include() [function.include]: Failed opening 'update-success.php?username=petenaylor' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/cndvizp/public_html/prints2impress.co.uk/upload/update-profile.php on line 94 The file update-success.php if definitely on the server because if i type update-success.php?username=petenaylor into the address bar it works OK? Cheers for your help Quote Link to comment https://forums.phpfreaks.com/topic/211294-include-url-with-variable/#findComment-1101701 Share on other sites More sharing options...
abdfahim Posted August 20, 2010 Share Posted August 20, 2010 include cannot parse stand-alone files. when you write include ('profile-success.php?username=$username'); it'll search for a file called "profile-success.php?username=$username" which obviously doesn't exist. Instead you could try include ('http://www.yourwebsite.com/profile-success.php?username=$username'); But the best thing for me is, assigning variables first, then call the page, will serve the same objective $_GET['username'] = $username; include ('profile-success.php'); Quote Link to comment https://forums.phpfreaks.com/topic/211294-include-url-with-variable/#findComment-1101705 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.