Solved

Redirect page in php with variable

Posted on 2011-02-26
4
266 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 63 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 62 total points
ID: 34990262
sjklein42 is right "$value" is evaluated in double quotes ... '$value' is passed on literally.

Ss
0

Featured Post

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
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 a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

626 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