How to send id through url

I want to send my id through url and want to get id in another page.

But how to send id through url Kindly help.

My Views which is not working.

<div class='title'><a href="<?php echo $Result->ad_id();?>"><?php echo ucwords($Result->ad_title);?></a></div>

Answers


Lets assume,

your domain name is http://www.muhammad.com

You are going pass id to index.php

<div class='title'>
    <a href="http://www.muhammad.com/index.php?id=<?php echo $Result->ad_id();?>"><?php echo ucwords($Result->ad_title);?></a>
</div>

In index.php

$submit_id = $_GET['id'];

This is your given code.

<div class='title'>
   <a href="<?php echo $Result->ad_id();?>">
      <?php echo ucwords($Result->ad_title);?>
   </a>
</div>

Here, the hyperlink is not correct. If you're using php without any framework, then add the link first before the id you want to pass.

<a href="http://example.com/anypage.php?id=<?php echo $Result->ad_id();?>">
   <?php echo ucwords($Result->ad_title);?>
</a>

Now, in the anypage.php, write some code to get the id from the url, i.e.

$id= $_GET("id");

Hope, it'll work! :)


This will help:

data is not passing through url

As an example, to pass id = 1234 to test.php:

test.php?id=1234

Then in test.php, the value of id will be available from $_GET['id'].


<div class='title'>
    <a href="<?php echo $Result->ad_id() . '?variable_name=variable_value' ?> "></a>
</div>

This is one way of query string for passing data using GET method...

protocol://domain_name?variable_name=variable_value

for example: http://test.com?sid=128001

So you can fetch the value in other page:

$var = $_GET['variable_name'];
//in this case:
$var = $_GET['sid'];

Need Your Help

Android — Are Android applications safe from outside illegitimate intrusion?

android forum financial banking onlinebanking

Well I have a concern, well talking to people on IRC Channel as well as seeing discussions on various android forums, I have been inclined towards the point that some of the android devices are

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.