• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to get the ID of the link in another page in php

phpmysql


PHP Snippet 1:

<a href="show.php?ref=<?php 
  echo htmlspecialchars(urlencode($row['name']));
?>&id=<?php 
  echo htmlspecialchars(urlencode($id));
?>" 
id="<?php 
  echo htmlspecialchars($id);
?>"><?php 
  echo htmlspecialchars($id) . '.' . htmlspecialchars($row['name']); 
?></a>

PHP Snippet 2:

<?php

   //show.php?ref=5&id=10

   echo $_GET['ref'];
   //5

   echo $_GET['id'];
   //10

?>

PHP Snippet 3:

<?php echo $_GET["id"]; ?>

Related Snippets

Limit of log line written to Apache Errorlog from mod php error_log

Can't remotely connect to MySQL error (13) with PHP script, connecting through CLI works

Insert And Retrieve Data in MySQL with $.post Noob Question

php retrieve specific data onclick from database in a list format

Star rating with half star support

PHP mail function is sending blank message body

PHP Form Not Inserting

merge all files in directory to one text file

Using if(isset($_POST['submit'])) to not display echo when script is open is not working

Custom post type single page not working

Correct way to use LIKE '%{$var}%' with prepared statements?

How to upload mpdf file after generating to s3 bucket in php

How to implement placeholder in a php file for moodle plugin?

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

WordPress - Dynamically add user ID to the end of a URL

About Contact Privacy policy Terms and conditions