Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Redirect page in php with variable

Posted on 2011-02-26
4
Medium Priority
?
267 Views
Last Modified: 2012-05-11
Hello,

I want to redirect page in php with variable.

I have variable  eg: $value
Assume $value=123;
and i am using code

<?php
header( 'Location: index.php?value=$value' ) ;

?>

but it doesn't work it shows link as it as

index.php?value=$value
0
Comment
Question by:savsofts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 34990245
Only echo does that automatically.
Value='.$value
0
 
LVL 3

Expert Comment

by:dtocci
ID: 34990246
Try something like this:
$value = 123;
$whereto = "index.php?" . $value;
header("Location: " . $whereto);
0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 252 total points
ID: 34990248
I think if you use double-quotes instead of single-quotes, the $value would be expanded.

header( "Location: index.php?value=$value") ;

Open in new window

0
 
LVL 9

Assisted Solution

by:sshah254
sshah254 earned 248 total points
ID: 34990262
sjklein42 is right "$value" is evaluated in double quotes ... '$value' is passed on literally.

Ss
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question