Append a text in the end of the url php [duplicate] - php

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 5 years ago.
i need to add a text in the end of the url while user click on a button.
for example :
www.example.com/people/xyz
when the user click the button, it should go to
www.example.com/people/xyz/edit
i did a search, & built code, but it didn't work, here it's :
$editlink = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
echo 'EDIT'
Please Help me to solve it

Correct your code as follows:
<?php
$editlink = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
?>
EDIT

Related

replace particular value from url [duplicate]

This question already has answers here:
PHP, Delete parts of a URL variable [duplicate]
(3 answers)
Closed 4 years ago.
I want to replace '/50' with URL.my URL is
http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby=
I want url as
http://localhost/CI/admin/pcustomer/cprofile?customer=18267&mobile=&nearby=
From that little info in your question, this seems to be the simplest way to achieve "I want to replace '/50' with URL"
$url = str_replace('/50', '', 'http://localhost/CI/admin/pcustomer/cprofile/50?customer=18267&mobile=&nearby=');

How to get a URL query next to the "#!" prefix? [duplicate]

This question already has answers here:
Get fragment (value after hash '#') from a URL [closed]
(10 answers)
Closed 7 years ago.
I'm trying to get the URL query next the "#!" prefix, for example:
https://mega.co.nz/#!123abc
<?php
$query=$_GET["#!"]; //the example
?>
$query: 123abc.
It is possible to read the query using PHP or .htaccess file? How i can get started?
Thanks for reading and for any help! :)
Try this,
Let your URL:
https://mega.co.nz?query=123abc
Then you can get value as below :
<?php
$query=$_GET["query"]; //the example
?>

Why my $_POST is empty? [duplicate]

This question already has answers here:
What is the difference between POST and GET? [duplicate]
(7 answers)
Closed 7 years ago.
I have no time and too tired to struggle with this, so I decided to ask here: I've created the file my.php which contains only:
<?php var_dump( $_POST ); ?>
And then I open the file using browser like this:
www.domain.com/my.php?post1=hey&post2=ho&post3=letsgo
And in the browser I have array(0) { } as a response.
Question: What could I possibly done wrong??
Thanks!
In URL are GET parameters, not POST.
echo $_GET['post1']; // hey
echo $_GET['post2']; // ho
echo $_GET['post3']; // letsgo
You cant pass POST variables through URL.
u r using GET method..

PHP echo a variable [duplicate]

This question already has answers here:
Reference - What does this error mean in PHP?
(38 answers)
Closed 8 years ago.
I am trying to put this line of code:
echo $row['url'];
between the quotations in this line of code:
$data = file_get_contents ("");
I have a link saved in my database which I want to be displayed between those brackets, but I keep getting syntax errors whatever way I try it. Is this possible or am I being stupid?
try that :
$data = file_get_contents ($row['url']);

Anti-Frame Busting code? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
My frame is redirecting page !! How to stop it ?
Is there any code like that ?
Please help..Thanks
If you mean a code that detects if it's in a frame, and if so, change the target location?
if (parent.frames.length > 0) parent.location.href = location.href;

Categories