NotSureILikePHP Posted July 20, 2015 Share Posted July 20, 2015 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. Quote Link to comment Share on other sites More sharing options...
Solution cyberRobot Posted July 20, 2015 Solution Share Posted July 20, 2015 (edited) 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 July 20, 2015 by cyberRobot Quote Link to comment Share on other sites More sharing options...
NotSureILikePHP Posted July 20, 2015 Author Share Posted July 20, 2015 Thanks, I for some reason was thinking because I didn't need to display it I didn't need to echo it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.