PHP: how to hide $GET_id from the link? - php

I want to hide the id from the link to be something like www.example.com/edit?DashboardId=14c140fc-b269-46e3-9649-d2c374d9d1e1&SelectedId=db250226-ad35-40ac-a321-1eedbe3460fc
My current link is www.example.com/edit?DashboardId=14

Related

How to change the URL without change the page in php?

I have this URL when I click on a link that redirect me in 'domaine.php/subject1' :
www.mywebsite.com/domaine.php/subject1
I want to display an URL like this when I want to see an other subject:
www.mywebsite.com/domaine.php/subject2
But when I click on the link 'domaine.php/subject2' in the same page (page:domaine.php), it display:
www.mywebsite.com/domaine.php/domaine.php/subject2
What can I do to fix it?
Thanks in advance!

Manipulate a URL

I am looking to change an URL on my site when sending a PM to use a user I click on the PM icon and get the URL as:
index.php?page=usercp&do=pm&action=edit&uid=10&what=new&to=ObieWan
I need that URL to be able to work for any user to send ObieWan a PM but it won't work as it's using my uid of 10.
The link looks like as follows and is in a .php file:
<font size="1">PM ObieWan</font>
Get the id of the current user and give it to the url like:
<?php
echo"
<a href='index.php?
page=usercp&do=pm&action=edit&uid='".$id."'&what=new&to=ObieWan'>This is the link
</a>";
?>
I have no idea about the rest of your code or database structure so you should get the ID from the user you want yourself. This is the way to pass the ID of the current user
If its the uid that you want to change then you can use $_GET['uid'] to set it.

link passing a variable while at the same time opening an id

I made a Modal Dialog that opens when you click the link
Edit Name
So after clicking that link the modal appears but the problem is that I don't know how to pass a usr variable for me to extract while at the same time opening the id called #modalDialog, something like this:
Edit Name
This other method redirects the page and opens the id, but the point is that I'm trying to avoid refreshing or redirecting to other pages just to edit a simple name, it goes like this:
Edit Name
I would to say thanks in advance!
I think you will want to use a data-* attribute within the anchor. Then access it using Javascript or JQuery.
<a href="#modalDialog" data-itemid="1" class="edit-name-link" >Edit Name</a>
Then in JQuery
$(".edit-name-link").click(
function()
{
var itemid = $(this).attr("data-itemid"); // this will get the clicked itemid
//now open your modal however you opened it before, and do something with itemid
});

How do I add GET data into an anchor tag so when users click it the data shows up in the URL?

I have a anchor tag and I would like it to pass GET data into the URL so I can access that data from a php script.
Here is an example
<a href="template.php" GET="product1"/>
<a href="template.php" GET="product2"/>
The above code does not work so I imagine that is not how it is done.
What I am trying to do is pass the GET data to template.php so it can display things depending on what the user clicks and what get data is sent.
Just create a querystring with a key that has meaning to you (I chose "item") and assign it the product key as the value:
Product 1
Now when a user clicks on that link you will have a $_GET variable of product1:
$item = $_GET['item']; // product1
Like this:
product1

Facebook Like button for a specific id

From the homepage I will click on an image which has an id and then be directed to a page which shows more details about that id.
I want to have a facebook like button on the page that would contain information about that specific id but I don't know what to type in the data-href
<div class="fb-like" data-href="http://www.test.com/php/test.php?id=" data-send="true" data-width="150" data-show-faces="false"></div>
specify that is it static or coming from database ?
for database, pass the php variable in the url:
echo "<div class='fb-like' data-href='http://www.test.com/php/test.php?id='".$id."data-send='true' data-width='150' data-show-faces='false'></div>";

Categories