Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi, can some one please help me for making url like this

somesite.com/index.php?id=111111&name=sam

i know it's something like this

PHP
<?php

$id = $_GET['id'];

?>


but how do i make it to get name "sam" from that id 111111 when i go to that url ?

Thanks.
Posted

1 solution

As you have done for the id, like this:
$name = $_GET['name'];

Read this: PHP 5 Form Handling[^]. Look for the method='get' in the form tag example.
 
Share this answer
 
v2
Comments
Member 10749093 21-Jan-15 21:42pm    
hey Peter, can you tell me how do i make it like for example, there's many links on the page but not displaying until i put the id on url. so if i put id on url then link must show up in body of the page. hope you understand and thanks.
Peter Leow 21-Jan-15 22:04pm    
Not clear. Can you show some code and html pages and how you want to navigate between them?
Member 10749093 21-Jan-15 22:15pm    
if(isset($_GET["id"]) && trim($_GET["id"]) == 'hi')
Member 10749093 21-Jan-15 22:16pm    
look at that code, it has only 1 "id" i want to make it like this somesite.com/index.php?id=111111&name=sam
Not like this somesite.com/index.php?id=111111
Peter Leow 21-Jan-15 22:34pm    
this url somesite.com/index.php?id=111111&name=sam has 2 query strings id="111111" and name="sam"
To capture them on the server side, do this:
if(isset($_GET["id"]) && trim($_GET["id"]) == '111111' && isset($_GET["name"]) && trim($_GET["id"]) == 'sam' ) {
// if id = "111111" and name="sam"
// then do something
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900