Morning everyone --

Can anyone help me with what is probably very simple?

I have a page where I want to get a variable from the URL and insert it in the buy button... so if my url is

I want when someone click the button Buy to go to

Thanks in advance!

Recommended Answers

All 5 Replies

In my view alone html is not capable of doing so.
What is your server side language?

As default it's php. Thanks

In your file you can read passed get or post variables using php arrays $_GET AND $_POST in your case, its get variable id

Now we set new link in your hangout.php as following


<a href='<?php echo $_GET['id']?>' > click here to join </a>

If the id is stored in session you can write the link like this:

.... part of the page .....
<a href='<?php echo $_SESSION['id']?>' > click here to join </a>
... rest of the page ....

or a button

<button id="join_button" onclick="<?php header( 'Location:'.$_SESSION['id'])">Join</button>

Thank you Utrivedi, It works like a charm

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.