-2

I have this code in my page1.php which passes 2 variables.(im using pdo btw)

<a type="button" href="PT-ContractsInfo.php?id=<?php echo $pt['TL_Code']?>&amp;client=<?php echo $pt['CLIENT_ID']?>" class="btn bg-green" >View</a>

...And my code for page2.php

    <?php
       $id = $_GET['id'];
       $client = $_GET['client'];
    <?

But it outputs an error "Undefined index: client"... Is there something wrong with the codes?Ty

DanMan
  • 11,323
  • 4
  • 40
  • 61

1 Answers1

0

you have semicolon missing

<?php echo $pt['TL_Code']?>

should be

<?php echo $pt['TL_Code']; ?>

but anyways you want to be careful when echoing variables in an url, you should encode the variable in url format first

like

<?php echo urlencode( $pt['TL_Code'] ); ?>

you can also use http_build_query() which would be even cleaner

Nathanael
  • 870
  • 5
  • 11