There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot computer connection crash css dell drive driver drivers email error ethernet excel explorer firefox firefox 3 freeze hard drive internet internet explorer itunes laptop linux malware monitor network networking outlook outlook 2003 outlook express password printer problem problems ram router security slow software sound trojan usb virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: PHP variables


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Jon1001's Avatar
Computer Specs
Senior Member with 207 posts.
 
Join Date: Jun 2007
Experience: Intermediate
24-Mar-2008, 01:12 PM #1
Solved: PHP variables
Hi

I am working on a page which uses a number of variables in the url. The problem is that I want to use a link to change one of the variables without affecting the others.

Eg

http://domain/file?one=1&two=2

Is it possible to change the variable called 'two' without affecting 'one'? If so, how?
Sequal7's Avatar
Computer Specs
Distinguished Member with 2,369 posts.
 
Join Date: Apr 2001
Location: Around the corner!
Experience: Including today?
24-Mar-2008, 01:55 PM #2
It should be in an array or variable within your script, change the array for two.
Jon1001's Avatar
Computer Specs
Senior Member with 207 posts.
 
Join Date: Jun 2007
Experience: Intermediate
24-Mar-2008, 02:26 PM #3
Sorry, on reading it back, the message isn't very clear. What I want to do is link to the same page (reload it) but change one of the variables in the url first. I would normally use PHP_SELF for something like this but it would result in putting the same variable in the url twice since it already exists. I would like to change one of the variables in the url before reloading the page. Here's an example similar to my problem:

domain/file?id=1&page=1

reload page with:

domain/file?id=1&page=2

Hope this makes more sense.
TheRobatron's Avatar
Computer Specs
Senior Member with 470 posts.
 
Join Date: Oct 2007
Location: England
Experience: Intermediate
24-Mar-2008, 06:48 PM #4
You could try this:
PHP Code:
$id $_REQUEST['ID'];
$page $_REQUEST['page'];
$page $page 1
Then make a submit button to the same page, sending all the variables.

Hope that helps.

Last edited by TheRobatron : 24-Mar-2008 07:06 PM.
haswalt's Avatar
Computer Specs
Senior Member with 416 posts.
 
Join Date: Nov 2004
Location: South Coast, UK
Experience: Advanced
25-Mar-2008, 05:04 AM #5
or use a "header" command to take make the page reload, but then this depends whether any content has been displayed to the browser or not yet.
Jon1001's Avatar
Computer Specs
Senior Member with 207 posts.
 
Join Date: Jun 2007
Experience: Intermediate
25-Mar-2008, 12:06 PM #6
thanks for the replies. unfortunately the header command wouldn't work as the variables are only changed once the user clicks on a link on the page but by using theRobatron's suggestion and some if statements, I have managed to get it working correctly. thanks again. Jon.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 07:22 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.