Jump to content

Should be simple


Go to solution Solved by cyberRobot,

Recommended Posts

I might have figured this out by the time I get a response but then again maybe not. I am trying to dynamically add hyperlinks to a grid that I am populating. Here is the code:

 

 

<?php
        if ($count) {
            $ids= ($errors && is_array($_POST['ids'])) ? $_POST['ids'] : null;
               foreach ($custs as $cust) {
                $id = $cust->getId();
                $name = $cust->getName();
                ?>
            <tr id="<?php echo $id; ?>">
                <td width=7px>
                  <input type="checkbox" class="ckb" name="ids[]"
                  value="<?php echo $id; ?>"
                  <?php echo $sel? 'checked="checked"' : ''; ?>
                  <?php echo $default? 'disabled="disabled"' : ''; ?> >
                </td>
                <td><a href="customers.php?t=customer&id=<?php $id ?>"><?php echo $name; ?></a></td>
            </tr>
            <?php
            } //end of foreach.
        } ?>

[/]

 

It builds the link customers.php?t=customer&id=

 

However, when I echo out the $id it displays. I'm sure there's something simple I'm not doing here but not sure what it is.

Link to comment
https://forums.phpfreaks.com/topic/297383-should-be-simple/
Share on other sites

  • Solution

Try changing this

<td><a href="customers.php?t=customer&id=<?php $id ?>"><?php echo $name; ?></a></td>
 
To this
<td><a href="customers.php?t=customer&id=<?php echo $id; ?>"><?php echo $name; ?></a></td>
Edited by cyberRobot
Link to comment
https://forums.phpfreaks.com/topic/297383-should-be-simple/#findComment-1516855
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.