A1Nasir
A1Nasir

Reputation: 81

pass value in url href in php

i am facing some issue, while on click (button) code is working and routing the values in url to next page .. but i want to route same values through a href tag ... any one can help me .. while my code is not retrieving the values ...

  echo  '<a href="clicheck.php?empid=<?php echo $row['empid'];?>&agentname=<?php echo $row['agentname'];?>&doj=<?php echo $row['doj'];?>&department=<?php echo $row['department'];?>&division=<?php echo $row['division'];?>&designation=<?php echo $row['designation'];?>&image=<?php echo $row['image'];?> ">- Evaluate -</a>'; 

Upvotes: 1

Views: 237

Answers (5)

Khan Luke
Khan Luke

Reputation: 168

Try this. Guaranteed.

 <?php
    $hello=$row['empid'];
    $bye=$row['agentname'];
    ?>
<a href="clicheck.php?empid=<?php echo $hello ; ?>&agentname=<?php echo $bye ; ?>"> Mylink</a>

Upvotes: 3

A1Nasir
A1Nasir

Reputation: 81

echo "<a href='evaluationsheet.php?empid= ". $_GET["empid"] ." && agentname= ". $_GET["agentname"] ." && doj= ". $_GET["doj"] ." && department= ". $_GET["department"] ." && division= ". $_GET["division"] ." && designation= ". $_GET["designation"] ." && image= ". $_GET["image"] ." && cli= ". $_POST["cli"] ." && callduration= ". $_POST["callduration"] ."  '>Hello " . $_GET["empid"] . "</h1>";

Upvotes: 1

Mehravish Temkar
Mehravish Temkar

Reputation: 4365

This will work :)

echo  '<a href="clicheck.php?empid='.$row['empid'].'&agentname='.$row['agentname'].'&doj='.$row['doj'].'&department='.$row['department'].'&division='.$row['division'].'&designation='.$row['designation'].'&image='.$row['image'].'">- Evaluate -</a>'; 

Upvotes: 4

Akshay Shrivastav
Akshay Shrivastav

Reputation: 1227

Replace your code with this:

echo "<a href='clicheck.php?empid={$row['empid']}&agentname={$row['agentname']}&doj={$row['doj']}&department={$row['department']}&division={$row['division']}&designation={$row['designation']}&image={$row['image']}'> - Evaluate</a>";

Upvotes: 1

David
David

Reputation: 218827

You're trying to echo PHP code to the page. (And creating a string quoting error in the process.) The browser won't know what to do with PHP code. Evaluate all of the PHP code server-side, for example...

Instead of something like this:

echo  '<a href="clicheck.php?empid=<?php echo $row['empid'];?>&agentname...';

You want something like this:

echo  '<a href="clicheck.php?empid=' . $row['empid'] . '&agentname...';

That is, instead of trying to echo <?php ... ?> tags, just echo the values themselves as one concatenated string.

Upvotes: 1

Related Questions