Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > PHP How-To
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 7th, 2006, 04:06 PM
Registered User
 
Join Date: Jan 2006
Location: Atlanta, GA, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default changing the value of variables in PHP

Hi there. I am trying to create a simple PHP program using the following code:

<?php
    $myfavmovie = urlencode(Madagascar);

  echo "<a href='moviesite.php?favmovie=$myfavmovie'>";
  echo "Click here to see information about my favorite movie!";
  echo "</a>";
?>

I have a page that this is linked to - which seems to work fine, but when I change the value of "$myfavmovie" to anything else, "Madagascar" continues to show up. Are variables completely static within a page such that I cannot change them once I have assigned a value to it? That doesn't seem to me to be correct...

Here is the code on the subsequent page to which this is linked in case that matters...

<?php

echo "My favorite movie is ";
echo $_REQUEST['favmovie'];

?>

I am much obliged.
Reply With Quote
  #2 (permalink)  
Old January 8th, 2006, 12:09 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: London, London, United Kingdom.
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've tried your code and it works fine..

If you change the value of $myfavmovie in the 1st file (save and press refresh on your browser) it does change the value in the second (when you click the link).. I don't undertand where the problem is ??
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing php variables using the href tag Rayne84 PHP How-To 11 July 12th, 2007 02:47 PM
Changing variables in match templates chicken XSLT 0 September 11th, 2006 10:26 AM
HOW DECLARE VARIABLES IN PHP jhan316 Beginning PHP 1 July 25th, 2006 07:16 PM
Passing Variables from PHP to PHP brian3166 PHP How-To 4 January 31st, 2005 12:44 AM
passing variables from PHP to Perl joconnor Beginning PHP 4 July 21st, 2004 08:13 AM



All times are GMT -4. The time now is 01:39 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.