Re: forward variable info via header()
| From: | Cody Caughlan | Date: | Thu, 24 Aug 2000 18:45:37 +0000 |
| Subject: | Re: forward variable info via header() | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2343@lists.php.net to get a copy of this message | ||
I pass variables after the ? part in the URL to my header() all day long, and
no problems,
I would suggest doing all the urlencode()'ing first into variables and then
building the string..
$branch_cd = urlencode($branch_cd);
$name = urlencode($name);
....
.
.
$info = "branch_cd=$branch_cd&name=$name";
header("Location somepage.html?$info");
should now work...also it looks like you are using a comma as your string
concatenation operator, the
correct operator is a period (.)
$myname = "firstname = " . $firstname;
good luck
/cody
Bennett wrote:
> Hello folks,
>
> I'm a PHP newbie trying to figure one last piece of a
> project that I've been working on this summer.
>
> I'm trying to use php to forward information collected from
> previous pages to a new page by way of a .php file using the
> header function like this:
>
> Header("Location: newpage.html");
>
> but, I have a lot of info I'd like to pass along with it. So, I'm trying to
> build this info into a variable like this:
>
> $info = "branch_cd=", urlencode($branch_cd), "&name=",
> urlencode($name) ... ; etc.
>
> (the information in $branch_cd and $name is from the previous
> page).
>
> so that I can do this:
>
> Header ("Location: newpage.html?$info");
>
> But when I try to add the field names as text and the urlencoded
> php variable information into the $info variable I get a parse error.
>
> Basically, all I'm trying to do is forward the information collected in
> the php variables from the previous page via the header function.
>
> Does anyone happen to know how to do this?
>
> I've also tried just building the url directly into header() like this:
>
> Header("Location: newpage.html?branch_cd=",
> urlencode($branch_cd), "&name=", urlencode($name));
>
> But that doesn't work either. The url ends up only sending what's in
> the first set of double quotes. It shows like this:
> http://www.company.com/newpage.html?branch_cd=
>
> and that's it.
>
> Any help would be greatly appreciated.
> Thank you,
>
> PS. The reason I'm using Header(); is because I have the php file
> making a decision as to which page to go to.
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
--
Cody Caughlan -codyc@cisco.com- Cisco Systems
Web/Database Engineer phone: (408) 525-6029
Enterprise Line of Business pager: (408) 951-9949