Jump to content

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/162151-changing-php-variable-in/
Share on other sites

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"?

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[)

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)

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.