duckfin Posted June 14, 2009 Share Posted June 14, 2009 Hey everyone, I've been looking online for almost an hour trying to solve this problem. I really don't know much about PHP, unfortunately; however, I PHP is probably going to be the perfect solution for a little problem of mine. I'm a member of a site which allows its users to customize their own "Quick Menu" of links. I'm limited by the site, as it takes the link input and adds it to the Menu with an automatic <a href> tag. The different pages of the site have basic PHP variables (only two to each page) in their urls. What I need specifically, is a way to change one variable while keeping the other the same, and it all has to be able to be run inside the aforementioned <a href> tag. An arbitrary example of the site would be: Every page has a url of http://url/index.php?x=xvalue&y=yvalue The site already has a Next/Previous link, so clicking next could increase xvalue by one. What I need, is to be able to set xvalue to a specific number, and keep everything else the same. Thank you for your time Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/ Share on other sites More sharing options...
RichardRotterdam Posted June 14, 2009 Share Posted June 14, 2009 You could do this with php using $_GET. That way you can get the vars from the url. Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855693 Share on other sites More sharing options...
duckfin Posted June 14, 2009 Author Share Posted June 14, 2009 I thank you for the reply, but I just tried that to no avail. It simply prints the PHP code as the link, or it will append it to the end of the website name, with no actual results (i.e. http://siteurl/phpcode and it brings up http://siteurl) Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855761 Share on other sites More sharing options...
RichardRotterdam Posted June 14, 2009 Share Posted June 14, 2009 I thank you for the reply, but I just tried that to no avail. It simply prints the PHP code as the link, or it will append it to the end of the website name, with no actual results (i.e. http://siteurl/phpcode and it brings up http://siteurl) What is the code you have tried? and what do you mean with "it simply prints the php code as link"? Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855769 Share on other sites More sharing options...
duckfin Posted June 14, 2009 Author Share Posted June 14, 2009 I tried entering <?php echo 'http://siteurl/index.php?x=xvalue&y=$_GET["y"]'; ?>. The, the link in the menu will be something like: http://siteurl/<?php echo 'http://siteurl/index.php?x=xvalue&y=$_GET["y"]'; ?> Though sometimes it cuts off parts of it (i.e. http://siteurl/<?php echo 'http://siteurl/index.php?x=xvalue&y=$_GET[) Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855784 Share on other sites More sharing options...
wildteen88 Posted June 14, 2009 Share Posted June 14, 2009 Where are editing the line link to. We need to see more code than you have posted Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855789 Share on other sites More sharing options...
RichardRotterdam Posted June 14, 2009 Share Posted June 14, 2009 it shouldn't display the php tags at all. Most likely your not using a webserver. Are you running apache, IIS or any other webserver on your computer? Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855790 Share on other sites More sharing options...
duckfin Posted June 14, 2009 Author Share Posted June 14, 2009 it shouldn't display the php tags at all. Most likely your not using a webserver. Are you running apache, IIS or any other webserver on your computer? Haha nope, this is all client-side. The site is not mine and I have no access to anything server-side. The site itself gives support for adding simple HTML links to the Quick Menu, and I was hoping that since members can essentially add custom HTML code, I would be able to add php as well. I know the server is running PHP (as the pages all include index.php, duh x.x lol) Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855799 Share on other sites More sharing options...
wildteen88 Posted June 14, 2009 Share Posted June 14, 2009 Seems what you're trying to do is not possible. You'll have to get in contact with the site owner. Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855805 Share on other sites More sharing options...
duckfin Posted June 14, 2009 Author Share Posted June 14, 2009 Seems what you're trying to do is not possible. Ah yes, that is what I had feared. Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855811 Share on other sites More sharing options...
.josh Posted June 14, 2009 Share Posted June 14, 2009 being able to add arbitrary html is nowhere near the same as being able to insert arbitrary php script. If they actually allowed that...pfft. What you might want to do is try to see about doing it with javascript. It's possible they might possibly allow js to be inserted. doubt it, but much more likely than server-side scripting. Quote Link to comment https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/#findComment-855816 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.