Jump to content

Include url with variable


petenaylor
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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');

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.