Showing posts with label get url parameters. Show all posts
Showing posts with label get url parameters. Show all posts

How to get value from url in php

How to get value from url in php.

In this tutorial,I will explain How to get value from url in php.If you are creating website using PHP then programmers use URL to sent data to another page.
In PHP, $_GET variable is used to get values from url in php.Information sent from a url is visible to everyone.

Example: Get value of URL

index.html
<table>
<tbody>
<tr>
<td>
Name: <input name="name" type="text" />
</td>
<td>
Mobile: <input name="mobile" type="text" />
</td>
</tr>
<tr>
<td>
<a href="http://www.blogger.com/example.php?name='Test'">Next</a></td></tr>
</tbody>
</table>


When the user clicks the "Next" link, the URL sent to the server look like this:
http://www.example.com/example.php?name='Test'

Now you can use $_GET variable to Get the value of the previous url in php

Example.php
<?php

$name=$_GET["name"];

echo $name;

?>


Output:Test


Bookmark and Share

Javascript get url parameters

Javascript get url parameters.

In this article, I will explain  how to get url parameters in javascript.We are using following JavaScript code to get url parameters using javascript.I have written simple javascript function which will get a URL parameter and return it to you.
Suppose,My URL is http://example.com/pagename.html?a=1&b=2 and i want to
get parameters a=1,b=2
please check following code to Retrieve URL GET parameters with Javascript.


Bookmark and Share

Javascript get url page name

Javascript get url page name.

In this article, I will explain  how to get page name from url in javascript.We are using following JavaScript code to get url page name using javascript.The filename is the last part of the URL from the last trailing slash ('/').
Suppose,My URL is http://example.com/pagename.html and i want to get page name pagename.html


Bookmark and Share